Re: [PATCH][RFC] Adding information of counts processes acquired how many spinlocks to schedstat II

From: Andi Kleen
Date: Wed Jul 01 2009 - 09:51:28 EST


On Wed, Jul 01, 2009 at 11:07:49AM +0200, Ingo Molnar wrote:
> His arguments are bogus: both lockstat and perfcounters are optional
> (and default off), and the sw counter can be made near zero cost
> even if both perfcounters and lockstat is enabled. Also, sw counters
> are generally per CPU, etc. so not a performance issue.

BTW I looked through the code generated by this again. As far as I
can see it still uses a global flag word to enable/disable the counter.

The standard problem -- discussed a lot -- with that set up used to be that
if the kernel is entered cache cold then you end up with a potential full cache
miss (200-1000 cycles) just to access that global variable. The old LTT
had a neat optimization to patch in immediate values to avoid this problem.

Has this been considered for these counters? With such a change
it might be indeed a "small" cost even in the worst cases.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/