Skip to content

Commit c4e927d

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: intel_powerclamp: Remove accounting for IRQ wakes
There is a static variable "idle_wakeup_counter", which accounts for number of wake ups because of IRQs and take actions to compensate idle injection. This is now read and reset to 0, but never incremented. So all the usage of this counter for idle injection has no use. Also another static variable "reduce_irq", which depends on "idle_wakeup_counter", so remove usage of "reduce_irq" also. Commit feb6cd6 ("thermal/intel_powerclamp: stop sched tick in forced idle") replaced the local use of "mwait_idle_with_hints" with play_idle(). This removed possibility of updating "idle_wakeup_counter" without change in play_idle(). This change was made in Linux 4.10. Signed-off-by: Srinivas Pandruvada <[email protected]> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 68b99e9 commit c4e927d

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

drivers/thermal/intel/intel_powerclamp.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ static struct dentry *debug_dir;
6262
static unsigned int set_target_ratio;
6363
static unsigned int current_ratio;
6464
static bool should_skip;
65-
static bool reduce_irq;
66-
static atomic_t idle_wakeup_counter;
65+
6766
static unsigned int control_cpu; /* The cpu assigned to collect stat and update
6867
* control parameters. default to BSP but BSP
6968
* can be offlined.
@@ -285,9 +284,6 @@ static unsigned int get_compensation(int ratio)
285284
cal_data[ratio + 1].steady_comp) / 3;
286285
}
287286

288-
/* REVISIT: simple penalty of double idle injection */
289-
if (reduce_irq)
290-
comp = ratio;
291287
/* do not exceed limit */
292288
if (comp + ratio >= MAX_TARGET_RATIO)
293289
comp = MAX_TARGET_RATIO - ratio - 1;
@@ -301,13 +297,9 @@ static void adjust_compensation(int target_ratio, unsigned int win)
301297
struct powerclamp_calibration_data *d = &cal_data[target_ratio];
302298

303299
/*
304-
* adjust compensations if confidence level has not been reached or
305-
* there are too many wakeups during the last idle injection period, we
306-
* cannot trust the data for compensation.
300+
* adjust compensations if confidence level has not been reached.
307301
*/
308-
if (d->confidence >= CONFIDENCE_OK ||
309-
atomic_read(&idle_wakeup_counter) >
310-
win * num_online_cpus())
302+
if (d->confidence >= CONFIDENCE_OK)
311303
return;
312304

313305
delta = set_target_ratio - current_ratio;
@@ -347,14 +339,7 @@ static bool powerclamp_adjust_controls(unsigned int target_ratio,
347339
tsc_last = tsc_now;
348340

349341
adjust_compensation(target_ratio, win);
350-
/*
351-
* too many external interrupts, set flag such
352-
* that we can take measure later.
353-
*/
354-
reduce_irq = atomic_read(&idle_wakeup_counter) >=
355-
2 * win * num_online_cpus();
356342

357-
atomic_set(&idle_wakeup_counter, 0);
358343
/* if we are above target+guard, skip */
359344
return set_target_ratio + guard <= current_ratio;
360345
}

0 commit comments

Comments
 (0)