mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Stijn Devriendt <highguy@gmail.com>,
	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 10:18:59 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.01.0911161011130.9384@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0911160945470.9384@localhost.localdomain>



On Mon, 16 Nov 2009, Linus Torvalds wrote:
> 
> Think of it like a classic user-level threading package, where one process 
> implements multiple threads entirely in user space, and switches between 
> them. Except we'd do the exact reverse: create multiple threads in the 
> kernel, but only run _one_ of them at a time. So as far as the scheduler 
> is concerned, it acts as just a single thread - except it's a single 
> thread that has multiple instances associated with it.

Side note: before anybody asks why not do threads in user space to begin 
with, it's simple: IO, exceptions, and timers. All need kernel support. 

User-level threading works very well, and is usually efficient as hell. 
It's not that long since people constantly claimed that thread libraries 
in user space were much better, and tried to use complex NxM models to do 
them, exactly because user threads are so great.

But almost nobody does user-level threading now, except for specific 
languages that are built around threading. Why? It's not because they 
don't work, it's because they have a few very annoying problems that make 
them not work at all for enough situations that it gets very painful. And 
it's usually about IO and system calls, but sometimes it's about page 
faults, and sometimes it's about the pain of multiplexing that annoying 
timer signal and all the crap that involves.

So I'm suggesting that maybe we could look at doing kernel threads that do 
what user-level threading does. It sounds idiotic, and maybe it is - after 
all, traditionally one of the reasons for user-level threads is that you 
can avoid all the kernel overheads. But if we can make some really 
low-overhead "thread within a thread" model, maybe we could have close to 
the best of both worlds.

Some people really want threads for multi-CPU workloads and spreading 
things out. That's what we have now. But other loads want threads for 
entirely different reasons, like just hiding IO latencies.

			Linus

  reply	other threads:[~2009-11-16 18:19 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 [this message]
2009-11-16 18:31     ` Alan Cox
2009-11-16 19:49     ` Stijn Devriendt
2009-11-16 20:13       ` Ingo Molnar
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=alpine.LFD.2.01.0911161011130.9384@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --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=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome