From: Ingo Molnar <mingo@elte.hu>
To: Stijn Devriendt <highguy@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Mike Galbraith <efault@gmx.de>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Andrea Arcangeli <andrea@suse.de>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
peterz@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] observe and act upon workload parallelism: PERF_TYPE_PARALLELISM (Was: [RFC][PATCH] sched_wait_block: wait for blocked threads)
Date: Mon, 16 Nov 2009 21:13:35 +0100 [thread overview]
Message-ID: <20091116201335.GC360@elte.hu> (raw)
In-Reply-To: <c76f371a0911161149p5416c992o64e926890b8b32c0@mail.gmail.com>
* Stijn Devriendt <highguy@gmail.com> wrote:
> One extra catch, I didn't even think of in the original approach is
> that you still need a way of saying to the kernel: no more work here.
>
> My original approach fails bluntly and I will happily take credit for
> that ;) The perf-approach perfectly allows for this, by waking up the
> "controller" thread which does exactly nothing as there's no work
> left.
Note, the perf approach does not require a 'controller thread'.
The most efficient approach using perf-events would be:
- have the pool threads block in poll(perf_event_fd). (all threads
block in poll() on the same fd).
- blocking threads wake_up() the pool and cause them to drop out of
poll() (with no intermediary). [if there's less than
perf_event::min_concurrency tasks running.]
- waking threads observe the event state and only run if we are still
below perf_event::max_concurrency - otherwise they re-queue to the
poll() waitqueue.
Basically the perf-event fd creates the 'group of tasks'. This can be
created voluntarily by cooperating threads - or involuntarily as well
via PID attach or CPU attach.
There's no 'tracing' overhead or notification overhead: we maintain a
shared state and the 'notifications' are straight wakeups that bring the
pool members out of poll(), to drive the workload further.
Such a special sw-event, with min_concurrency==max_concurrency==1 would
implement Linus's interface - using standard facilities like poll().
(The only 'special' act is the set up of the group itself.)
So various concurrency controls could be implemented that way -
including the one Linus suggest - even a HPC workload-queueing daemon
could be done as well, which sheperds 100% uncooperative tasks.
I dont think this 'fancy' approach is actually a performance drag: it
would really do precisely the same thing Linus's facility does (unless
i'm missing something subtle - or something less subtle about Linus's
scheme), with the two parameters set to '1'.
( It would also enable a lot of other things, and it would not tie the
queueing implementation into the scheduler. )
Only trying would tell us for sure though - maybe i'm wrong.
Thanks,
Ingo
next prev parent reply other threads:[~2009-11-16 20:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-15 19:04 [RFC][PATCH] sched_wait_block: wait for blocked threads Stijn Devriendt
2009-11-15 19:04 ` [PATCH] Initial prototype version of sched_wait_block Stijn Devriendt
2009-11-16 8:35 ` [RFC] observe and act upon workload parallelism: PERF_TYPE_PARALLELISM (Was: [RFC][PATCH] sched_wait_block: wait for blocked threads) Ingo Molnar
2009-11-16 18:02 ` Linus Torvalds
2009-11-16 18:18 ` Linus Torvalds
2009-11-16 18:31 ` Alan Cox
2009-11-16 19:49 ` Stijn Devriendt
2009-11-16 20:13 ` Ingo Molnar [this message]
2009-11-21 11:26 ` Stijn Devriendt
2009-11-16 19:13 ` Stijn Devriendt
2009-11-16 20:22 ` Ingo Molnar
2009-11-18 9:30 ` Stijn Devriendt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091116201335.GC360@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=andrea@suse.de \
--cc=efault@gmx.de \
--cc=highguy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.