From: Oleg Nesterov <oleg@tv-sign.ru>
To: Gautham R Shenoy <ego@in.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
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>,
Paul E McKenney <paulmck@us.ibm.com>
Subject: Re: [RFC PATCH 1/4] Refcount Based Cpu-Hotplug Implementation
Date: Sun, 21 Oct 2007 16:47:44 +0400 [thread overview]
Message-ID: <20071021124744.GA174@tv-sign.ru> (raw)
In-Reply-To: <20071017053754.GB9940@in.ibm.com>
On 10/17, Gautham R Shenoy wrote:
>
> On Wed, Oct 17, 2007 at 10:47:41AM +1000, Rusty Russell wrote:
> >
> > I can't see where you re-initialize the completion.
>
> The cpu_hotplug.readers_done is a global variable which has been
> initialized in cpu_hotplug_init.
>
> So I am wondering is the re-initialization required ?
I don't understand why should we re-initialize the completion too,
but see below.
> > > +static void cpu_hotplug_begin(void)
> > > +{
> > > + mutex_lock(&cpu_hotplug.lock);
> > > + cpu_hotplug.active_writer = current;
> > > + while (cpu_hotplug.refcount) {
> > > + mutex_unlock(&cpu_hotplug.lock);
> > > + wait_for_completion(&cpu_hotplug.readers_done);
> > > + mutex_lock(&cpu_hotplug.lock);
> > > + }
> >
> > AFAICT this will busy-wait on the second CPU hotplug.
Why?
> Well when the first cpu_hotplug comes out of wait_for_completion, it
> would have decremented the ->done count, so it's as good as new
> for the second CPU hotplug, no?
No, because we decrement the ->done count only once, but there is no
guarantee that ->done == 1 when we get CPU after wakeup. Another reader
can do lock_cpu_hotplug/unlock_cpu_hotplug in between, so we have a race.
But I disagree with "Yet once a completion is completed, it needs to be
re-initialized to be reused: it's "complete" and wait_for_completion
will return immediately thereafter".
Rusty, could you please clarify?
Side note, we don't block the new readers while cpu_hotplug_begin() waits
for the completion. I don't think this is a problem, but perhaps it makes
sense to document the possible livelock.
Oleg.
next prev parent reply other threads:[~2007-10-21 12:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-16 10:33 [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit Gautham R Shenoy
2007-10-16 10:34 ` [RFC PATCH 1/4] Refcount Based Cpu-Hotplug Implementation Gautham R Shenoy
2007-10-17 0:47 ` Rusty Russell
2007-10-17 5:37 ` Gautham R Shenoy
2007-10-17 6:29 ` Rusty Russell
2007-10-18 6:29 ` Gautham R Shenoy
2007-10-21 12:47 ` Oleg Nesterov [this message]
2007-10-17 10:53 ` Paul Jackson
2007-10-17 11:27 ` Paul Jackson
2007-10-17 11:50 ` Gautham R Shenoy
2007-10-17 12:04 ` Paul Jackson
2007-10-16 10:35 ` [RFC PATCH 2/4] Rename lock_cpu_hotplug to get_online_cpus Gautham R Shenoy
2007-10-17 16:13 ` Nathan Lynch
2007-10-18 7:57 ` Gautham R Shenoy
2007-10-18 8:22 ` Nathan Lynch
2007-10-18 8:59 ` Gautham R Shenoy
2007-10-18 17:30 ` Nathan Lynch
2007-10-19 5:04 ` Gautham R Shenoy
2007-10-22 0:43 ` Nathan Lynch
2007-10-22 4:51 ` Gautham R Shenoy
2007-10-16 10:36 ` [RFC PATCH 3/4] Replace per-subsystem mutexes with get_online_cpus Gautham R Shenoy
2007-10-21 11:39 ` Oleg Nesterov
2007-10-22 4:58 ` Gautham R Shenoy
2007-10-16 10:37 ` [RFC PATCH 4/4] Remove CPU_DEAD/CPU_UP_CANCELLED handling from workqueue.c Gautham R Shenoy
2007-10-17 11:57 ` Oleg Nesterov
2007-10-16 17:20 ` [RFC PATCH 0/4] Refcount Based Cpu-Hotplug Revisit Linus Torvalds
2007-10-17 2:11 ` Dipankar Sarma
2007-10-17 2:23 ` Linus Torvalds
2007-10-17 4:17 ` 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=20071021124744.GA174@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=dipankar@in.ibm.com \
--cc=ego@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@us.ibm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.