Re: [PATCH][RFC] Adding information of counts processes acquiredhow many spinlocks to schedstat

From: Hitoshi Mitake
Date: Wed Jul 01 2009 - 05:42:55 EST


From: Ingo Molnar <mingo@xxxxxxx>
Subject: Re: [PATCH][RFC] Adding information of counts processes acquired how many spinlocks to schedstat
Date: Wed, 1 Jul 2009 11:07:49 +0200

>
> * Hitoshi Mitake <mitake@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> > From: Andi Kleen <andi@xxxxxxxxxxxxxx>
> > Subject: Re: [PATCH][RFC] Adding information of counts processes acquired how many spinlocks to schedstat
> > Date: Wed, 01 Jul 2009 09:38:04 +0200
> >
> > > Hitoshi Mitake <mitake@xxxxxxxxxxxxxxxxxxxxx> writes:
> > >
> > > > Hi,
> > > >
> > > > I wrote a test patch which add information of counts processes acquired how many spinlocks to schedstat.
> > > > After applied this patch, /proc/<PID>/sched will change like this,
> > >
> > > The problem is that spinlocks are very common and schedstats is
> > > enabled commonly in production kernels. You would need to
> > > demonstrate that such a change doesn't have significant
> > > performance impact. For me it looks like it has.
> >
> > I agree with your opinion about performance impact.
> > I thought this will make no problem,
> > because schedstat is categorized as "Kernel hacking" section.
> > But according to you, many production kernels enable it
> > so my patch will make widespread performance degradation.
> > I didn't know that, sorry.
>
> 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.
>
> The only (small) overhead will be when the lock-acquire sw counter
> is actively enabled because you run 'perf stat -e lock-acquire' -
> but that is expected and inherent in pretty much any kind of
> instrumentation.
>
> The feature you are working on has the chance to be a very useful
> and popular piece of instrumentation. Being able to tell the lock
> acquire stats on a per task, per workload, per CPU or system-wide
> basis is a unique capability no other tool can offer right now.
>
> Andi is often trolling perfcounters related (and other) threads,
> please dont let yourself be deterred by that and feel free to ignore
> him.
OK, at least it is truth that
counter in perfcounters makes only valid overhead.

And I have a question,
I tried to build perf, but I got a build error,

util/symbol.c: In function âdso__load_symâ:
util/symbol.c:466: error: âELF_C_READ_MMAPâ undeclared (first use in this function)
util/symbol.c:466: error: (Each undeclared identifier is reported only once
util/symbol.c:466: error: for each function it appears in.)

I used this libelf,
http://www.mr511.de/software/english.html
but constant ELF_C_READ_MMAP is not provided...

which "libelf" should I use?
It seems that there are some libelf implementations.
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i