History

thermal: intel_powerclamp: Use first online CPU as control_cpu

Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") fixed an issue related to using smp_processor_id() in preemptible context by replacing it with a pair of get_cpu()/put_cpu(), but what is needed there really is any online CPU and not necessarily the one currently running the code. Arguably, getting the one that's running the code in there is confusing. For this reason, simply give the control CPU role to the first online one which automatically will be CPU0 if it is online, so one check can be dropped from the code for an added benefit.

Rafael J. Wysocki committed 4 years ago

Commit 4bb7f6c1 parent aa512c11 file · +1 −5Browse files

Unified · Split

drivers/thermal/intel/intel_powerclamp.c+1−5
@@ -516,11 +516,7 @@ static int start_power_clamp(void) · 515 unmodified lines
516516 cpus_read_lock();
517517
518518 /* prefer BSP */
519− control_cpu = 0;
520− if (!cpu_online(control_cpu)) {
521− control_cpu = get_cpu();
522− put_cpu();
523− }
519+ control_cpu = cpumask_first(cpu_online_mask);
524520
525521 clamping = true;
526522 schedule_delayed_work(&poll_pkg_cstate_work, 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t