public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: linux-kernel@vger.kernel.org, Jason Baron <jbaron@redhat.com>,
	Max Krasnyansky <maxk@qualcomm.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Subject: Re: [PATCH 2/3] stop_machine: simplify
Date: Wed, 9 Jul 2008 12:11:38 +1000	[thread overview]
Message-ID: <200807091211.39457.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20080708142703.GB8278@Krystal>

On Wednesday 09 July 2008 00:27:03 Mathieu Desnoyers wrote:
> Hi Rusty,
>
> * Rusty Russell (rusty@rustcorp.com.au) wrote:
> > stop_machine creates a kthread which creates kernel threads.  We can
> > create those threads directly and simplify things a little.  Some care
> > must be taken with CPU hotunplug, which has special needs, but that code
> > seems more robust than it was in the past.
> >
> > Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> > ---
> >  include/linux/stop_machine.h |   12 -
> >  kernel/cpu.c                 |   13 -
> >  kernel/stop_machine.c        |  299
> > ++++++++++++++++++------------------------- 3 files changed, 135
> > insertions(+), 189 deletions(-)
> >
> > diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
> > --- a/include/linux/stop_machine.h
> > +++ b/include/linux/stop_machine.h
> > @@ -17,13 +17,12 @@
> >   * @data: the data ptr for the @fn()
> >   * @cpu: if @cpu == n, run @fn() on cpu n
> >   *       if @cpu == NR_CPUS, run @fn() on any cpu
> > - *       if @cpu == ALL_CPUS, run @fn() first on the calling cpu, and
> > then - *       concurrently on all the other cpus
> > + *       if @cpu == ALL_CPUS, run @fn() on every online CPU.
> >   *
>
> I agree with this change if it makes things simpler. However, callers
> must be aware of this important change :
>
> "run @fn() first on the calling cpu, and then concurrently on all the
> other cpus" becomes "run @fn() on every online CPU".

OK.  Since that was never in mainline, I think you're the only one who needs 
to be aware of the semantic change?

The new symmetric implementation breaks it; hope that isn't a showstopper for 
you?

> There were assumptions done in @fn() where a simple non atomic increment
> was used on a static variable to detect that it was the first thread to
> execute. It will have to be changed into an atomic inc/dec and test.
> Given that the other threads have tasks to perform _after_ the first
> thread has executed, they will have to busy-wait (spin) there waiting
> for the first thread to finish its execution.

I assume you can't do that step then call stop_machine.

Thanks,
Rusty.

  reply	other threads:[~2008-07-09  4:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08  7:50 [PATCH 0/3] stop_machine enhancements and simplifications Rusty Russell
2008-07-08  7:56 ` [PATCH 1/3] stop_machine: add ALL_CPUS option Rusty Russell
2008-07-08  7:56   ` [PATCH 2/3] stop_machine: simplify Rusty Russell
2008-07-08  8:01     ` [PATCH 3/3] stop_machine: use cpu mask rather than magic numbers Rusty Russell
2008-07-10 21:07       ` [PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace Milton Miller
2008-07-11  6:43         ` Rusty Russell
2008-07-11  7:46         ` Ingo Molnar
2008-07-11  8:55           ` Ingo Molnar
2008-07-11 12:34           ` Rusty Russell
2008-07-08 11:44     ` [PATCH 2/3] stop_machine: simplify Akinobu Mita
2008-07-08 13:11       ` Rusty Russell
2008-07-08 15:02         ` Akinobu Mita
2008-07-09  2:18           ` Rusty Russell
2008-07-08 14:27     ` Mathieu Desnoyers
2008-07-09  2:11       ` Rusty Russell [this message]
2008-07-09 12:42         ` Mathieu Desnoyers
2008-07-10  0:30     ` Max Krasnyansky
2008-07-11  7:51       ` Rusty Russell
2008-07-11 13:12         ` Mathieu Desnoyers
2008-07-12  5:07           ` Rusty Russell
2008-07-08 16:21 ` [PATCH 0/3] stop_machine enhancements and simplifications Christian Borntraeger
2008-07-08 20:10 ` Jason Baron
2008-07-09  3:29   ` Mathieu Desnoyers

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=200807091211.39457.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=maxk@qualcomm.com \
    --cc=seto.hidetoshi@jp.fujitsu.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