Using kprobes [was Re: [PATCH] Performance Stats: Kernel patch

Maxim Uvarov muvarov at ru.mvista.com
Tue May 22 01:28:27 EST 2007


Linas Vepstas wrote:

>On Thu, May 10, 2007 at 11:12:42AM -0700, Andrew Morton wrote:
>  
>
>>I don't think the syscall-counting feature has a future, sorry.  Perhaps
>>you could do something like hooking it up on-demand by insertion of a kprobe,
>>dunno.
>>    
>>
>
>This is an interesting point. I've started fiddling with (a wrapper
>around) kprobes that allows me to pick any subroutine symbol in System.map,
>and then get an event whenever that subroutine gets called. Its pretty
>slick, and allows me to gather data on certain unusual events in the
>kernel.  (I'm not using this for performance monitoring, I'm trying to 
>do RAS).
>
>It makes a lot of sense to me to have a generic kprobe extension, where 
>you could give it a list of subroutine names, and it'll collect stats
>on the number of times that the routine was called. Some user-space thingy
>could poll for those stats, or you could put them in /sys or wherever.
>
>Its more complicted than just instriumenting syscalls, but a lot more
>useful, I would think ... 
>
>--linas
>
>  
>
Thanks Linas, but do you think that kprobes is safe for syscall counting?
I think that the overhead will be much bigger in that case. In my case it is
1 line asm instruction and it is defended with #ifdefs.

Kprobes is very good thing. But is not clear for me how to count 
per-thread statistics.
In my case I increased struct thread_info. In case with kprobes it is 
easy to count all
do_fork execution, for example, but not for each thread. And in any 
case, place for keeping this
counters is needed.

Maxim.



More information about the Linuxppc-dev mailing list