lkml.org 
[lkml]   [2016]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] perf/core: fix implicitly enable dynamic interrupt throttle
Date
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
\
 
 \ /
  Last update: 2016-05-03 17:01    [W:0.047 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site