LKML Archive on
help / color / mirror / Atom feed
From: Jarek Poplawski <>
To: Oleg Nesterov <>
Cc: Andrew Morton <>,
	Dipankar Sarma <>,
	Gautham R Shenoy <>,
	Jarek Poplawski <>,
	Srivatsa Vaddagiri <>,
Subject: Re: [PATCH 1/2] workqueues: shrink cpu_populated_map when CPU dies
Date: Sun, 17 Feb 2008 21:27:39 +0100	[thread overview]
Message-ID: <20080217202739.GA2994@ami.dom.local> (raw)
In-Reply-To: <>

Hi Oleg,

This patch looks OK to me. But while reading this I got some doubts
in nearby places, so BTW 2 small questions:

1) ... workqueue_cpu_callback(...)
        list_for_each_entry(wq, &workqueues, list) {
                cwq = per_cpu_ptr(wq->cpu_wq, cpu);

                switch (action) {
                case CPU_UP_PREPARE:

It looks like not all CPU_ cases are served here: shouldn't
list_for_each_entry() be omitted for them?

2) ... __create_workqueue_key(...)
        if (singlethread) {
        } else {
                list_add(&wq->list, &workqueues);

Shouldn't this list_add() be done after all these inits below?


                for_each_possible_cpu(cpu) {
                        cwq = init_cpu_workqueue(wq, cpu);
Jarek P.

On Sat, Feb 16, 2008 at 08:22:59PM +0300, Oleg Nesterov wrote:
> When cpu_populated_map was introduced, it was supposed that cwq->thread can
> survive after CPU_DEAD, that is why we never shrink cpu_populated_map.
> This is not very nice, we can safely remove the already dead CPU from the map.
> The only required change is that destroy_workqueue() must hold the hotplug lock
> until it destroys all cwq->thread's, to protect the cpu_populated_map. We could
> make the local copy of cpu mask and drop the lock, but sizeof(cpumask_t) may be
> very large.
> Also, fix the comment near queue_work(). Unless _cpu_down() happens we do
> guarantee the cpu-affinity of the work_struct, and we have users which rely on
> this.
> Signed-off-by: Oleg Nesterov <>

  reply	other threads:[~2008-02-17 20:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16 17:22 Oleg Nesterov
2008-02-17 20:27 ` Jarek Poplawski [this message]
2008-02-17 23:45   ` Oleg Nesterov
2008-02-18  7:50     ` Jarek Poplawski

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080217202739.GA2994@ami.dom.local \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 1/2] workqueues: shrink cpu_populated_map when CPU dies' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).