linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH 2/4] sched: implement __set_cpus_allowed()
Date: Mon, 31 May 2010 11:55:38 +0200	[thread overview]
Message-ID: <4C03879A.8030505@kernel.org> (raw)
In-Reply-To: <1275292866.27810.21441.camel@twins>

Hello,

On 05/31/2010 10:01 AM, Peter Zijlstra wrote:
> On Thu, 2010-05-13 at 12:48 +0200, Tejun Heo wrote:
>> Concurrency managed workqueue needs to be able to migrate tasks to a
>> cpu which is online but !active for the following two purposes.
>>
>> p1. To guarantee forward progress during cpu down sequence.  Each
>>     workqueue which could be depended upon during memory allocation
>>     has an emergency worker task which is summoned when a pending work
>>     on such workqueue can't be serviced immediately.  cpu hotplug
>>     callbacks expect workqueues to work during cpu down sequence
>>     (usually so that they can flush them), so, to guarantee forward
>>     progress, it should be possible to summon emergency workers to
>>     !active but online cpus.
> 
> If we do the thing suggested in the previous patch, that is move
> clearing active and rebuilding the sched domains until right after
> DOWN_PREPARE, this goes away, right?

Hmmm... yeah, if the usual set_cpus_allowed_ptr() keeps working
throughout CPU_DOWN_PREPARE, this probably goes away.  I'll give it a
shot.

>> p2. To migrate back unbound workers when a cpu comes back online.
>>     When a cpu goes down, existing workers are unbound from the cpu
>>     and allowed to run on other cpus if there still are pending or
>>     running works.  If the cpu comes back online while those workers
>>     are still around, those workers are migrated back and re-bound to
>>     the cpu.  This isn't strictly required for correctness as long as
>>     those unbound workers don't execute works which are newly
>>     scheduled after the cpu comes back online; however, migrating back
>>     the workers has the advantage of making the behavior more
>>     consistent thus avoiding surprises which are difficult to expect
>>     and reproduce, and being actually cleaner and easier to implement.
> 
> I still don't like this much, if you mark these tasks to simply die when
> the queue is exhausted, and flush the queue explicitly on
> CPU_UP_PREPARE, you should never need to do this.

I don't think flushing from CPU_UP_PREPARE would be a good idea.
There is no guarantee that those works will finish in short (human
scale) time, but we can update cpu_active mask before other
CPU_UP_PREPARE notifiers are executed so that it's symmetrical to cpu
down path and then this problem goes away the exact same way, right?

Thanks.

-- 
tejun

  reply	other threads:[~2010-05-31  9:55 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 10:48 [PATCHSET sched/core] sched: prepare for cmwq Tejun Heo
2010-05-13 10:48 ` [PATCH 1/4] sched: consult online mask instead of active in select_fallback_rq() Tejun Heo
2010-05-31  8:01   ` Peter Zijlstra
2010-05-31  9:48     ` Tejun Heo
2010-05-13 10:48 ` [PATCH 2/4] sched: implement __set_cpus_allowed() Tejun Heo
2010-05-31  8:01   ` Peter Zijlstra
2010-05-31  9:55     ` Tejun Heo [this message]
2010-05-31 10:01       ` Peter Zijlstra
2010-05-31 10:02         ` Peter Zijlstra
2010-05-31 10:06           ` Tejun Heo
2010-05-31 10:15             ` Peter Zijlstra
2010-05-31 10:19               ` Tejun Heo
2010-05-31 10:46                 ` Peter Zijlstra
2010-05-31 11:47                   ` Tejun Heo
2010-05-13 10:48 ` [PATCH 3/4] sched: refactor try_to_wake_up() Tejun Heo
2010-05-13 10:48 ` [PATCH 4/4] sched: add hooks for workqueue Tejun Heo
2010-05-31  8:01   ` Peter Zijlstra
2010-05-31  9:58     ` Tejun Heo
2010-05-31 10:05       ` Peter Zijlstra
2010-05-31 10:07         ` Tejun Heo
2010-05-17 23:13 ` [PATCHSET sched/core] sched: prepare for cmwq Tejun Heo
2010-05-21 13:25   ` Tejun Heo
2010-05-23  9:05     ` Ingo Molnar
2010-05-23  9:08       ` Tejun Heo
2010-05-23  9:13         ` Ingo Molnar
2010-05-23  9:24           ` Tejun Heo
2010-05-23 10:20             ` Ingo Molnar
2010-05-23 10:26               ` Tejun Heo
2010-05-27  8:26                 ` Tejun Heo

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=4C03879A.8030505@kernel.org \
    --to=tj@kernel.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).