From patchwork Fri May 24 11:16:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 165105 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3437483ili; Fri, 24 May 2019 04:16:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJOrAbUQUwSJgYCMrn4pvOEB77T7WpIn1i/SNBvHTiW/s/HZssEL/ovuxCFE5ROUXCLnWm X-Received: by 2002:a17:902:e08b:: with SMTP id cb11mr47059677plb.122.1558696615728; Fri, 24 May 2019 04:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558696615; cv=none; d=google.com; s=arc-20160816; b=W1oIfbudZiUkZhSb5oBEGCMz2TKUR85eRxLEJkiosqaBCf2cbxOdWD6ZJjUpLpolBN QERr53gMP4smU3PBLBKV2JBVJr5Bk4WHrg+twX1PgBVAb4j3+Qph5JuyIDuEbM9wIMyy qlF0jwAFNZxVuXZUh3vPjFz2fzTQ8b+kM7MvtgIkyc+p7rL2xsSI7XMgzhVAt7SMABMf mQl8zvBcHNWa6hVdxWy56yuMxvNRYhBzQB7HjVFvXWLw3fxJbz4YOYAyckZkEHHJNDtB HHB+SWc3p3K0YFZT/cCY7wiCKU4k/jNdR2a6dwyWXsi3MOZ1fwxhUN9IWwn9upI/QU0g SJyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=L7Wy/UoR346yun6rGdrn0w0Sk7Zt+3JLoV24BHUfklw=; b=l8pHedN2X3mgtr8hUof7Ftr3tc7YP2IEMBMxjK/tarQhk1WqYr5pOPFXpnGFjDXoj2 6GfdTiBwrfNJr0iTp00Yh6Uikb8kjHDmKor4uQNqjpnbFl3I6p4OI13415R4PTZNNBwX ObC8KbttwZhGaRSROGh8E3X6b144F88U3wNmxz6Ub2bTw+5qdeE5oSCl/2MFeAvqwTWE UaApHzp9MWxebZkdFcBTToR1pRq4JrrnVQV+396L0oIC5BhNSWKth6FfcHaXGsKCaClT i5J7Pzs2N2bXPY+Hz7f8DeAFTziGUiJa/qQDFd/HUrvby63j5yyHxHzLnKxLYoA9wc5A Ap0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="twWc4/+Q"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si3735560pgg.392.2019.05.24.04.16.55; Fri, 24 May 2019 04:16:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="twWc4/+Q"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390971AbfEXLQp (ORCPT + 30 others); Fri, 24 May 2019 07:16:45 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40051 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390410AbfEXLQl (ORCPT ); Fri, 24 May 2019 07:16:41 -0400 Received: by mail-wr1-f66.google.com with SMTP id t4so1326384wrx.7 for ; Fri, 24 May 2019 04:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L7Wy/UoR346yun6rGdrn0w0Sk7Zt+3JLoV24BHUfklw=; b=twWc4/+Qzxo/D1UOnToCY0eDa73j5l1K8Qp94mmxWXgleAnqOFh7FoKKZXgEX4YCZ0 k2+yDABe/dRSA4VkRLWycdfvXMNAh72chSlPqCET2BGRhVfJyuoVFeS8WwFTy7HwZ5LZ RHnk8bGliEfW33uzlNY+eHQRjzpwMaHQtca8eb9UsIl+QVPTpYk0CQDqCU8rAZQL+VCQ jIEpo5lLqbJeJcRRObCrX2EcluaWMkAhvFRcRKq0/9bjxxpX1u2WV6zE+8uh2LN2M9Lr 57VthcvkM2QDAh+/7dH2ni5xz4/7svNg+4NpIlS7Md0oowPzqWjkGBq9JjBEZSOqfKy7 JRNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L7Wy/UoR346yun6rGdrn0w0Sk7Zt+3JLoV24BHUfklw=; b=BSZtwcg4XluQ7viQ4XtYkCMRR+pZBDGs6broLnFyYVZOxRfKGJU05aNpYeQhZrBbDJ IOdne5850jWKU/EMSHt3FT7t55FTGrfQM6sseI2S0Ns0tFfRwvOD7iNuMNbofWU7JzEG m77FeVdJZdA/WAHZCLyTjKgvvtDFQVCAQiAF992GEfQWj6XXpyalcqS5cpb7tSnFHCXH ocM3hKZiHKjIY5MEQAgYCcjUC+DwFZvhCPNOtIiYQv2qXRogTxhroQYsQdzEw4rMh3ZC CSaW7SYHG7MRz8qFDJZTDQKc3FxJ782tQYfDPQLzUg2O/ZTlARBtwK36AzjkL9E2uSm2 Sm2g== X-Gm-Message-State: APjAAAVQtPmAUCddQQPr33+EQuFaTbS9jAcWkyNEGdLagc3N0UhPmKnl nz0vrIoGANNnr3prAZP2NUuwmw== X-Received: by 2002:adf:e94b:: with SMTP id m11mr5174901wrn.133.1558696600480; Fri, 24 May 2019 04:16:40 -0700 (PDT) Received: from clegane.local (73.82.95.92.rev.sfr.net. [92.95.82.73]) by smtp.gmail.com with ESMTPSA id h12sm2575392wre.14.2019.05.24.04.16.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 May 2019 04:16:39 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, andriy.shevchenko@linux.intel.com Subject: [PATCH V2 3/9] genirq/timings: Optimize the period detection speed Date: Fri, 24 May 2019 13:16:09 +0200 Message-Id: <20190524111615.4891-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190524111615.4891-1-daniel.lezcano@linaro.org> References: <20190524111615.4891-1-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we have a minimal period and if there is a period which is a multiple of it but lesser than the max period then it will be detected before and the minimal period will be never reached. 1 2 1 2 1 2 1 2 1 2 1 2 <-----> <-----> <-----> <-> <-> <-> <-> <-> <-> In our case, the minimum period is 2 and the maximum period is 5. That means all repeating pattern of 2 will be detected as repeating pattern of 4, it is pointless to go up to 2 when searching for the period as it will always fail. Remove one loop iteration by increasing the minimal period to 3. Signed-off-by: Daniel Lezcano --- kernel/irq/timings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/kernel/irq/timings.c b/kernel/irq/timings.c index 250bb00ccd85..06bde5253a7d 100644 --- a/kernel/irq/timings.c +++ b/kernel/irq/timings.c @@ -261,7 +261,7 @@ void irq_timings_disable(void) #define EMA_ALPHA_VAL 64 #define EMA_ALPHA_SHIFT 7 -#define PREDICTION_PERIOD_MIN 2 +#define PREDICTION_PERIOD_MIN 3 #define PREDICTION_PERIOD_MAX 5 #define PREDICTION_FACTOR 4 #define PREDICTION_MAX 10 /* 2 ^ PREDICTION_MAX useconds */