diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2012-07-25 01:56:04 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2013-01-27 13:23:27 -0500 |
commit | abf917cd91cbb73952758f9741e2fa65002a48ee (patch) | |
tree | 5f975b87615dcaed9c98bc74b4548d568b92dcbc /init | |
parent | ae8dda5c473bf1a85913942adcaac449e5754bf3 (diff) |
cputime: Generic on-demand virtual cputime accounting
If we want to stop the tick further idle, we need to be
able to account the cputime without using the tick.
Virtual based cputime accounting solves that problem by
hooking into kernel/user boundaries.
However implementing CONFIG_VIRT_CPU_ACCOUNTING require
low level hooks and involves more overhead. But we already
have a generic context tracking subsystem that is required
for RCU needs by archs which plan to shut down the tick
outside idle.
This patch implements a generic virtual based cputime
accounting that relies on these generic kernel/user hooks.
There are some upsides of doing this:
- This requires no arch code to implement CONFIG_VIRT_CPU_ACCOUNTING
if context tracking is already built (already necessary for RCU in full
tickless mode).
- We can rely on the generic context tracking subsystem to dynamically
(de)activate the hooks, so that we can switch anytime between virtual
and tick based accounting. This way we don't have the overhead
of the virtual accounting when the tick is running periodically.
And one downside:
- There is probably more overhead than a native virtual based cputime
accounting. But this relies on hooks that are already set anyway.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/init/Kconfig b/init/Kconfig index be8b7f55312d..a05f843e7e52 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -326,6 +326,9 @@ source "kernel/time/Kconfig" | |||
326 | 326 | ||
327 | menu "CPU/Task time and stats accounting" | 327 | menu "CPU/Task time and stats accounting" |
328 | 328 | ||
329 | config VIRT_CPU_ACCOUNTING | ||
330 | bool | ||
331 | |||
329 | choice | 332 | choice |
330 | prompt "Cputime accounting" | 333 | prompt "Cputime accounting" |
331 | default TICK_CPU_ACCOUNTING if !PPC64 | 334 | default TICK_CPU_ACCOUNTING if !PPC64 |
@@ -342,9 +345,10 @@ config TICK_CPU_ACCOUNTING | |||
342 | 345 | ||
343 | If unsure, say Y. | 346 | If unsure, say Y. |
344 | 347 | ||
345 | config VIRT_CPU_ACCOUNTING | 348 | config VIRT_CPU_ACCOUNTING_NATIVE |
346 | bool "Deterministic task and CPU time accounting" | 349 | bool "Deterministic task and CPU time accounting" |
347 | depends on HAVE_VIRT_CPU_ACCOUNTING | 350 | depends on HAVE_VIRT_CPU_ACCOUNTING |
351 | select VIRT_CPU_ACCOUNTING | ||
348 | help | 352 | help |
349 | Select this option to enable more accurate task and CPU time | 353 | Select this option to enable more accurate task and CPU time |
350 | accounting. This is done by reading a CPU counter on each | 354 | accounting. This is done by reading a CPU counter on each |
@@ -354,6 +358,23 @@ config VIRT_CPU_ACCOUNTING | |||
354 | this also enables accounting of stolen time on logically-partitioned | 358 | this also enables accounting of stolen time on logically-partitioned |
355 | systems. | 359 | systems. |
356 | 360 | ||
361 | config VIRT_CPU_ACCOUNTING_GEN | ||
362 | bool "Full dynticks CPU time accounting" | ||
363 | depends on HAVE_CONTEXT_TRACKING && 64BIT | ||
364 | select VIRT_CPU_ACCOUNTING | ||
365 | select CONTEXT_TRACKING | ||
366 | help | ||
367 | Select this option to enable task and CPU time accounting on full | ||
368 | dynticks systems. This accounting is implemented by watching every | ||
369 | kernel-user boundaries using the context tracking subsystem. | ||
370 | The accounting is thus performed at the expense of some significant | ||
371 | overhead. | ||
372 | |||
373 | For now this is only useful if you are working on the full | ||
374 | dynticks subsystem development. | ||
375 | |||
376 | If unsure, say N. | ||
377 | |||
357 | config IRQ_TIME_ACCOUNTING | 378 | config IRQ_TIME_ACCOUNTING |
358 | bool "Fine granularity task level IRQ time accounting" | 379 | bool "Fine granularity task level IRQ time accounting" |
359 | depends on HAVE_IRQ_TIME_ACCOUNTING | 380 | depends on HAVE_IRQ_TIME_ACCOUNTING |