Re: [PATCH] sched: wakeup buddy

From: Ingo Molnar
Date: Mon Mar 11 2013 - 04:21:14 EST



* Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:

> On Wed, 2013-03-06 at 15:06 +0800, Michael Wang wrote:
>
> > wake_affine() stuff is trying to bind related tasks closely, but it
> > doesn't work well according to the test on 'perf bench sched pipe'
> > (thanks to Peter).
>
> so sched-pipe is a poor benchmark for this..
>
> Ideally we'd write a new benchmark that has some actual data footprint
> and we'd measure the cost of tasks being apart on the various cache
> metrics and see what affine wakeup does for it.

Ideally we'd offer applications a new, lightweight vsyscall:

void sys_sched_work_tick(void)

Or, to speed up adoption, a new, vsyscall-accelerated prctrl():

prctl(PR_WORK_TICK);

which applications could call in each basic work unit they are performing.

Sysbench would call it for every transaction completed, sched-pipe would
call it for every pipe message sent, hackbench would call it for messages,
etc. etc.

This is a minimal application level change, but gives *huge* information
to the scheduler: we could balance tasks to maximize their observed work
rate.

The scheduler could also do other things, like observe the wakeup/sleep
patterns within a 'work atom', observe execution overlap between work
atoms and place tasks accordingly, etc. etc.

Today we approximate work atoms by saying that scheduling atoms == work
atoms. But that approximation breaks down in a number of important cases.

If we had such a design we'd be able to fix pretty much everything,
without the catch-22 problems we are facing normally.

An added bonus would be increased instrumentation: we could trace, time,
profile work atom rates and could collect work atom profiles. We see work
atom execution histograms, etc. etc. - stuff that is simply not possible
today without extensive application-dependent instrumentation.

We could also use utrace scripts to define work atoms without modifying
the application: for many applications we know which particular function
call means that a basic work unit was completed.

I have actually written the prctl() approach before, for instrumentation
purposes, and it does wonders to system analysis.

Any objections?

Thanks,

Ingo
--
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/