Re: [0.5/2] scheduler caller profiling

David Mosberger
2004-05-03T18:52:12Z

Bill> On Sun, May 02, 2004 at 07:17:09PM -0700, William Lee Irwin
Bill> III wrote:
>> The thundering herd issue in waitqueue hashing has been seen in
>> practice. In order to preserve the space footprint reduction
>> while improving performance, I wrote "filtered wakeups", which
>> discriminate between waiters based on a key.

Bill> This patch was used to collect the data on the offending
Bill> callers into the scheduler. It creates a profile buffer
Bill> completely analogous to its handling to /proc/profile, but
Bill> registers profile ticks at calls to the various scheduler
Bill> entry points instead of during timer ticks and rearranges
Bill> scheduler code for this to be accounted properly. It does not
Bill> report meaningful statistics in the presence of
Bill> CONFIG_PREEMPT.

Bill> Posting this patch is in order to disclose how I obtained the
Bill> scheduling statistics reported in the first post. This patch
Bill> is not intended for inclusion.

Note that on ia64, you can use q-syscollect/q-view to collect
call-counts statistically (with zero intrusion to the monitored
program, so it's safe for the kernel). While the call-graph/counts
won't be perfectly accurate, this has proven to work extremely well in
practice. In fact, it would be nice if other arches could support the
same. All you really need for this to work is the ability to count N
call (or return) instructions and record the source and destination
address of the N-th call somewhere (registers or memory). I looked at
the P4 performance-monitor briefly but I couldn't quite figure out
whether it supports the required functionality (it seemed like it
could only record _all_ branches, which would be a problem). If a
P4-expert is interested in pursuing this, let me know. I'd be happy
to help/advise with some of the more subtle issues that need to be
address to get this to work correctly.

--david