LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: ego@in.ibm.com, "Rafael J. Wysocki" <rjw@sisk.pl>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] add-suspend-related-notifications-for-cpu-hotplug-cleanup
Date: Tue, 1 May 2007 22:48:10 +0400	[thread overview]
Message-ID: <20070501184810.GA1585@tv-sign.ru> (raw)
In-Reply-To: <20070427184258.62794053.akpm@linux-foundation.org>

On 04/27, Andrew Morton wrote:
>
> We have a huge amount of change pending in the kthread/workqueue/freezer
> area, partly because I decided not to merge most of the workqueue changes
> into 2.6.21.
> 
> It'd be good if people could take some time to sit down and re-review the
> code which we presently have.  I plan on sending it all off for 2.6.22 and
> there might be some glitches but it seems to have a good track record so
> far.

Oops. I completely misread the ->cpus_allowed check in try_to_wake_up(), and
so workqueue_cpu_callback() needs a simple fix: CPU_UP_CANCELED should rebind
cwq->thread. Or, better, we should not bind the task until CPU_ONLINE.

I'll send the patch soon, but it conflicts with Rafael's

	add-suspend-related-notifications-for-cpu-hotplug.patch

, so I am sending this cleanup first to make them independent.

Actually, I believe almost all subsystems could be simplified as well, most
of them don't care about CPU_TASKS_FROZEN bit.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- OLD/kernel/workqueue.c~1_FROZEN	2007-05-01 22:13:10.000000000 +0400
+++ OLD/kernel/workqueue.c	2007-05-01 22:18:15.000000000 +0400
@@ -747,6 +747,8 @@ static int __devinit workqueue_cpu_callb
 	struct cpu_workqueue_struct *cwq;
 	struct workqueue_struct *wq;
 
+	action &= ~CPU_TASKS_FROZEN;
+
 	switch (action) {
 	case CPU_LOCK_ACQUIRE:
 		mutex_lock(&workqueue_mutex);
@@ -757,7 +759,6 @@ static int __devinit workqueue_cpu_callb
 		return NOTIFY_OK;
 
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		cpu_set(cpu, cpu_populated_map);
 	}
 
@@ -766,23 +767,19 @@ static int __devinit workqueue_cpu_callb
 
 		switch (action) {
 		case CPU_UP_PREPARE:
-		case CPU_UP_PREPARE_FROZEN:
 			if (!create_workqueue_thread(cwq, cpu))
 				break;
 			printk(KERN_ERR "workqueue for %i failed\n", cpu);
 			return NOTIFY_BAD;
 
 		case CPU_ONLINE:
-		case CPU_ONLINE_FROZEN:
 			wake_up_process(cwq->thread);
 			break;
 
 		case CPU_UP_CANCELED:
-		case CPU_UP_CANCELED_FROZEN:
 			if (cwq->thread)
 				wake_up_process(cwq->thread);
 		case CPU_DEAD:
-		case CPU_DEAD_FROZEN:
 			cleanup_workqueue_thread(cwq, cpu);
 			break;
 		}


  reply	other threads:[~2007-05-01 18:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25 23:10 2.6.21-rc7-mm1: BUG_ON in kthread_bind during _cpu_down Rafael J. Wysocki
2007-04-25 23:54 ` Andrew Morton
2007-04-26 10:09   ` Gautham R Shenoy
2007-04-26 10:15     ` Oleg Nesterov
2007-04-26 12:58       ` Gautham R Shenoy
2007-04-28  1:42         ` Andrew Morton
2007-05-01 18:48           ` Oleg Nesterov [this message]
2007-05-01 22:56           ` libata-core.c: unsafe cancel_delayed_work() usage? Oleg Nesterov
2007-05-01 23:35             ` Jeff Garzik
2007-05-01 23:48               ` Oleg Nesterov
2007-05-03 21:38           ` kernel/relay.c: a strange usage of delayed_work Oleg Nesterov
2007-05-04  5:42             ` Tom Zanussi
2007-04-26 10:20     ` 2.6.21-rc7-mm1: BUG_ON in kthread_bind during _cpu_down Eric W. Biederman
2007-04-26 20:20   ` Rafael J. Wysocki

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=20070501184810.GA1585@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --subject='Re: [PATCH] add-suspend-related-notifications-for-cpu-hotplug-cleanup' \
    /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

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