Commit 2e70933866ace52091a3c11a5c104c063ab0c445

Authored by Frederic Weisbecker
1 parent d65ec12127

nohz: Only enable context tracking on full dynticks CPUs

The context tracking subsystem has the ability to selectively
enable the tracking on any defined subset of CPU. This means that
we can define a CPU range that doesn't run the context tracking
and another range that does.

Now what we want in practice is to enable the tracking on full
dynticks CPUs only. In order to perform this, we just need to pass
our full dynticks CPU range selection from the full dynticks
subsystem to the context tracking.

This way we can spare the overhead of RCU user extended quiescent
state and vtime maintainance on the CPUs that are outside the
full dynticks range. Just keep in mind the raw context tracking
itself is still necessary everywhere.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Kevin Hilman <khilman@linaro.org>

Showing 3 changed files with 13 additions and 0 deletions Side-by-side Diff

include/linux/context_tracking.h
... ... @@ -34,6 +34,8 @@
34 34 return __this_cpu_read(context_tracking.active);
35 35 }
36 36  
  37 +extern void context_tracking_cpu_set(int cpu);
  38 +
37 39 extern void user_enter(void);
38 40 extern void user_exit(void);
39 41  
kernel/context_tracking.c
... ... @@ -26,6 +26,11 @@
26 26 #endif
27 27 };
28 28  
  29 +void context_tracking_cpu_set(int cpu)
  30 +{
  31 + per_cpu(context_tracking.active, cpu) = true;
  32 +}
  33 +
29 34 /**
30 35 * user_enter - Inform the context tracking that the CPU is going to
31 36 * enter userspace mode.
kernel/time/tick-sched.c
... ... @@ -23,6 +23,7 @@
23 23 #include <linux/irq_work.h>
24 24 #include <linux/posix-timers.h>
25 25 #include <linux/perf_event.h>
  26 +#include <linux/context_tracking.h>
26 27  
27 28 #include <asm/irq_regs.h>
28 29  
29 30  
... ... @@ -344,10 +345,15 @@
344 345  
345 346 void __init tick_nohz_init(void)
346 347 {
  348 + int cpu;
  349 +
347 350 if (!have_nohz_full_mask) {
348 351 if (tick_nohz_init_all() < 0)
349 352 return;
350 353 }
  354 +
  355 + for_each_cpu(cpu, nohz_full_mask)
  356 + context_tracking_cpu_set(cpu);
351 357  
352 358 cpu_notifier(tick_nohz_cpu_down_callback, 0);
353 359 cpulist_scnprintf(nohz_full_buf, sizeof(nohz_full_buf), nohz_full_mask);