public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kan.liang@intel.com
To: peterz@infradead.org
Cc: mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, ak@linux.intel.com,
	linux-kernel@vger.kernel.org, Kan Liang <kan.liang@intel.com>
Subject: [PATCH 1/1] perf/core: fix implicitly enable dynamic interrupt throttle
Date: Tue,  3 May 2016 00:26:06 -0700	[thread overview]
Message-ID: <1462260366-3160-1-git-send-email-kan.liang@intel.com> (raw)

From: Kan Liang <kan.liang@intel.com>

This patch fixes an issue which was introduced from 'commit 91a612eea9a3
("perf/core: Fix dynamic interrupt throttle")'
The old patch unconditionally sets the perf_sample_allowed_ns value to
!0. But that could trigger an issue in the following corner case.
The user can disable the dynamic interrupt throttle mechanism by setting
perf_cpu_time_max_percent to 0. Then they changes
perf_event_max_sample_rate.
For this case, the mechanism will be enabled implicitly, because
perf_sample_allowed_ns becomes !0.

This patch only updates the perf_sample_allowed_ns when the dynamic
interrupt throttle mechanism is enabled.

Signed-off-by: Kan Liang <kan.liang@intel.com>
---
 kernel/events/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4e2ebf6..4042a3d 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -375,6 +375,14 @@ static void update_perf_cpu_limits(void)
 {
 	u64 tmp = perf_sample_period_ns;
 
+	/*
+	 * Don't update the perf_sample_allowed_ns,
+	 * if the dynamic interrupt throttle mechanism is disabled.
+	 */
+	if (sysctl_perf_cpu_time_max_percent == 100 ||
+	    sysctl_perf_cpu_time_max_percent == 0)
+		return;
+
 	tmp *= sysctl_perf_cpu_time_max_percent;
 	tmp = div_u64(tmp, 100);
 	if (!tmp)
-- 
2.5.0

             reply	other threads:[~2016-05-03 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03  7:26 kan.liang [this message]
2016-05-12  9:31 ` [PATCH 1/1] perf/core: fix implicitly enable dynamic interrupt throttle Peter Zijlstra
2016-05-12 13:26   ` Liang, Kan
2016-06-03 10:50 ` [tip:perf/core] perf/core: Fix " tip-bot for Kan Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462260366-3160-1-git-send-email-kan.liang@intel.com \
    --to=kan.liang@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox