android_kernel_motorola_sm6225/include
Paul Mackerras c07c99b672 perfcounters: make context switch and migration software counters work again
Jaswinder Singh Rajput reported that commit 23a185ca8a caused the
context switch and migration software counters to report zero always.
With that commit, the software counters only count events that occur
between sched-in and sched-out for a task.  This is necessary for the
counter enable/disable prctls and ioctls to work.  However, the
context switch and migration counts are incremented after sched-out
for one task and before sched-in for the next.  Since the increment
doesn't occur while a task is scheduled in (as far as the software
counters are concerned) it doesn't count towards any counter.

Thus the context switch and migration counters need to count events
that occur at any time, provided the counter is enabled, not just
those that occur while the task is scheduled in (from the perf_counter
subsystem's point of view).  The problem though is that the software
counter code can't tell the difference between being enabled and being
scheduled in, and between being disabled and being scheduled out,
since we use the one pair of enable/disable entry points for both.
That is, the high-level disable operation simply arranges for the
counter to not be scheduled in any more, and the high-level enable
operation arranges for it to be scheduled in again.

One way to solve this would be to have sched_in/out operations in the
hw_perf_counter_ops struct as well as enable/disable.  However, this
takes a simpler approach: it adds a 'prev_state' field to the
perf_counter struct that allows a counter's enable method to know
whether the counter was previously disabled or just inactive
(scheduled out), and therefore whether the enable method is being
called as a result of a high-level enable or a schedule-in operation.

This then allows the context switch, migration and page fault counters
to reset their hw.prev_count value in their enable functions only if
they are called as a result of a high-level enable operation.
Although page faults would normally only occur while the counter is
scheduled in, this changes the page fault counter code too in case
there are ever circumstances where page faults get counted against a
task while its counters are not scheduled in.

Reported-by: Jaswinder Singh Rajput <jaswinder@kernel.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-02-13 12:20:38 +01:00
..
acpi acpi/x86: introduce __apci_map_table, v4 2009-02-09 13:35:07 +01:00
asm-arm
asm-frv byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
asm-generic linker script: use separate simpler definition for PERCPU() 2009-01-30 23:27:46 +01:00
asm-h8300
asm-m32r byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
asm-mn10300 byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
crypto crypto: shash - Fix tfm destruction 2009-02-05 16:51:25 +11:00
drm drm/i915: add fence register management to execbuf 2009-02-08 21:38:02 +10:00
keys
linux perfcounters: make context switch and migration software counters work again 2009-02-13 12:20:38 +01:00
math-emu
media Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 2009-02-02 19:26:06 -08:00
mtd headers_check fix: mtd/inftl-user.h 2009-01-31 00:13:34 +05:30
net net: wrong test in inet_ehash_locks_alloc() 2009-01-27 17:45:10 -08:00
pcmcia
rdma
rxrpc
scsi [SCSI] iscsi_tcp: make padbuf non-static 2009-01-13 10:41:34 -06:00
sound headers_check fix: sound/hdsp.h 2009-01-31 00:13:56 +05:30
trace
video atyfb: fix CONFIG_ namespace violations 2009-02-05 12:56:48 -08:00
xen xen: add xenfs to allow usermode <-> Xen interaction 2009-01-08 08:30:59 -08:00
Kbuild