mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Akinobu Mita" <akinobu.mita@gmail.com>
To: "Rusty Russell" <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org, "Jason Baron" <jbaron@redhat.com>,
	"Mathieu Desnoyers" <mathieu.desnoyers@polymtl.ca>,
	"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 00:02:02 +0900	[thread overview]
Message-ID: <961aa3350807080802w7e6acef9g4e931e26b3061d7e@mail.gmail.com> (raw)
In-Reply-To: <200807082311.35793.rusty@rustcorp.com.au>

2008/7/8 Rusty Russell <rusty@rustcorp.com.au>:
> On Tuesday 08 July 2008 21:44:40 Akinobu Mita wrote:
>> I found a small possible cleanup in this patch.
>
> Well spotted!  I think this cleanup is actually orthogonal to my patch,
> so best served as a separate patch, how's this?

Actually the cpu_online() check was necessary before appling this
stop_machine: simplify patch.

With old __stop_machine_run(), __stop_machine_run() could succeed
(return !IS_ERR(p) value) even if take_cpu_down() returned non-zero value.
The return value of take_cpu_down() was obtained through kthread_stop().

> ===
> Hotplug CPU: don't check cpu_online after take_cpu_down

So it seems that folding this patch into stop_machine: simplify patch is
more appropriate.

> Akinobu points out that if take_cpu_down() succeeds, the cpu must be offline
> (otherwise we're in deep trouble anyway.
>
> Remove the cpu_online() check, and put a BUG_ON().
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Akinobu Mita" <akinobu.mita@gmail.com>
>
> diff -r 805a2e5e68dd kernel/cpu.c
> --- a/kernel/cpu.c      Tue Jul 08 23:04:48 2008 +1000
> +++ b/kernel/cpu.c      Tue Jul 08 23:07:43 2008 +1000
> @@ -226,8 +226,7 @@ static int __ref _cpu_down(unsigned int
>        set_cpus_allowed_ptr(current, &tmp);
>
>        err = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
> -
> -       if (err || cpu_online(cpu)) {
> +       if (err) {
>                /* CPU didn't die: tell everyone.  Can't complain. */
>                if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
>                                            hcpu) == NOTIFY_BAD)
> @@ -235,6 +234,7 @@ static int __ref _cpu_down(unsigned int
>
>                goto out_allowed;
>        }
> +       BUG_ON(cpu_online(cpu));
>
>        /* Wait for it to sleep (leaving idle task). */
>        while (!idle_cpu(cpu))
>

  reply	other threads:[~2008-07-08 15:02 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-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 [this message]
2008-07-09  2:18           ` Rusty Russell
2008-07-08 14:27     ` Mathieu Desnoyers
2008-07-09  2:11       ` Rusty Russell
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-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 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=961aa3350807080802w7e6acef9g4e931e26b3061d7e@mail.gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=maxk@qualcomm.com \
    --cc=rusty@rustcorp.com.au \
    --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

all inboxes | Powered by JetHome®