Skip to content

Commit

Permalink
nohz: Only enable context tracking on full dynticks CPUs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Frederic Weisbecker committed Aug 12, 2013
1 parent d65ec12 commit 2e70933
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/linux/context_tracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ static inline bool context_tracking_active(void)
return __this_cpu_read(context_tracking.active);
}

extern void context_tracking_cpu_set(int cpu);

extern void user_enter(void);
extern void user_exit(void);

Expand Down
5 changes: 5 additions & 0 deletions kernel/context_tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ DEFINE_PER_CPU(struct context_tracking, context_tracking) = {
#endif
};

void context_tracking_cpu_set(int cpu)
{
per_cpu(context_tracking.active, cpu) = true;
}

/**
* user_enter - Inform the context tracking that the CPU is going to
* enter userspace mode.
Expand Down
6 changes: 6 additions & 0 deletions kernel/time/tick-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/irq_work.h>
#include <linux/posix-timers.h>
#include <linux/perf_event.h>
#include <linux/context_tracking.h>

#include <asm/irq_regs.h>

Expand Down Expand Up @@ -344,11 +345,16 @@ static int tick_nohz_init_all(void)

void __init tick_nohz_init(void)
{
int cpu;

if (!have_nohz_full_mask) {
if (tick_nohz_init_all() < 0)
return;
}

for_each_cpu(cpu, nohz_full_mask)
context_tracking_cpu_set(cpu);

cpu_notifier(tick_nohz_cpu_down_callback, 0);
cpulist_scnprintf(nohz_full_buf, sizeof(nohz_full_buf), nohz_full_mask);
pr_info("NO_HZ: Full dynticks CPUs: %s.\n", nohz_full_buf);
Expand Down

0 comments on commit 2e70933

Please sign in to comment.