public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gautham R Shenoy <ego@in.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Srivatsa Vaddagiri <vatsa@in.ibm.com>,
	Dipankar Sarma <dipankar@in.ibm.com>, Ingo Molnar <mingo@elte.hu>,
	Oleg Nesterov <oleg@tv-sign.ru>
Subject: Re: [RFC PATCH 4/5] Remove CPU_DEAD/CPU_UP_CANCELLED handling from workqueue.c
Date: Wed, 24 Oct 2007 14:05:14 +0530	[thread overview]
Message-ID: <20071024083514.GA15451@in.ibm.com> (raw)
In-Reply-To: <200710241721.05163.rusty@rustcorp.com.au>

Hello Rusty, 
On Wed, Oct 24, 2007 at 05:21:04PM +1000, Rusty Russell wrote:
> On Wednesday 24 October 2007 15:37:16 Gautham R Shenoy wrote:
> > @@ -712,7 +712,7 @@ static void start_workqueue_thread(struc
> >
> >  	if (p != NULL) {
> >  		if (cpu >= 0)
> > -			kthread_bind(p, cpu);
> > +			set_cpus_allowed(p, cpumask_of_cpu(cpu));
> >  		wake_up_process(p);
> >  	}
> 
> Hi Gautham!
> 
> 	This works, although the change is unnecessary.  

This change was necessary because once a cpu goes offline, the worker
threads for that particular cpu, sleep with their state being
TASK_INTERRUPTIBLE. Thus, during CPU_ONLINE, when we call
start_workqueue_thread(), kthread_bind() yells since the worker thread
is not TASK_UNINTERRUPTIBLE.

Probably later on when Oleg plans to re-introduce the ->should_stop
flag, we can put the worker threads to uninterruptible sleep, and revert 
back to kthread_bind().

> If you're going to
> do this I'd prefer "if (set_cpus_allowed(p, cpumask_of_cpu(cpu)) != 0) 
> BUG();".

Not sure if this is required. set_cpus_allowed() returns a non-zero
value only if the cpumask passed doesn't intersect with the cpu-online
map. In our case, start_workqueue_thread() is called only when the cpu 
is online. i.e

a) __create_workqueue_key() calls start_workqueue_thread() with
get_online_cpus() protection only for those cpus which are online.

b) workqueue_cpu_callback() calls start_workqueue_thread() on event
of a CPU_ONLINE.

> 
> Cheers,
> Rusty.

Thanks and Regards
gautham.
-- 
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"

  reply	other threads:[~2007-10-24  8:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24  5:29 [RFC PATCH 0/5] Refcount based Cpu Hotplug. V2 Gautham R Shenoy
2007-10-24  5:30 ` [RFC PATCH 1/5] Refcount Based Cpu Hotplug implementation Gautham R Shenoy
2007-10-24  5:32 ` [RFC PATCH 2/5] Replace lock_cpu_hotplug() with get_online_cpus() Gautham R Shenoy
2007-10-24  5:34 ` [RFC PATCH 3/5] Replace per-subsystem mutexes " Gautham R Shenoy
2007-10-24  5:37 ` [RFC PATCH 4/5] Remove CPU_DEAD/CPU_UP_CANCELLED handling from workqueue.c Gautham R Shenoy
2007-10-24  7:21   ` Rusty Russell
2007-10-24  8:35     ` Gautham R Shenoy [this message]
2007-10-24 13:44     ` Oleg Nesterov
2007-10-24 13:38   ` Oleg Nesterov
2007-10-24 17:45     ` Gautham R Shenoy
2007-10-24 18:14       ` Oleg Nesterov
2007-10-24  5:39 ` [RFC PATCH 5/5] Update get_online_cpus() in Documentation/cpu-hotplug.c Gautham R Shenoy
2007-10-24 17:04 ` [RFC PATCH 0/5] Refcount based Cpu Hotplug. V2 Christoph Lameter
2007-10-24 18:00   ` Gautham R Shenoy
2007-10-24 18:17     ` Oleg Nesterov
2007-10-24 18:22       ` Gautham R Shenoy

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=20071024083514.GA15451@in.ibm.com \
    --to=ego@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    --cc=vatsa@in.ibm.com \
    /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