[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160913084552.GG5008@twins.programming.kicks-ass.net>
Date: Tue, 13 Sep 2016 10:45:52 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Cheng Chao <cs.os.kernel@...il.com>
Cc: mingo@...nel.org, oleg@...hat.com, tj@...nel.org,
akpm@...ux-foundation.org, chris@...is-wilson.co.uk,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful
works for CONFIG_PREEMPT_NONE
On Tue, Sep 13, 2016 at 12:03:05PM +0800, Cheng Chao wrote:
>
> Peter, Is it as a new patch?
I wanted both changes in one pathc, but I fudged my git-diff.
> > ---
> > kernel/stop_machine.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
> > index ae6f41fb9cba..637798d6b554 100644
> > --- a/kernel/stop_machine.c
> > +++ b/kernel/stop_machine.c
> > @@ -121,6 +121,11 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
> > cpu_stop_init_done(&done, 1);
> > if (!cpu_stop_queue_work(cpu, &work))
> > return -ENOENT;
> > + /*
> > + * In case @cpu == smp_proccessor_id() we can avoid a sleep+wakeup
> > + * by doing a preemption.
> > + */
> > + cond_resched();
> > wait_for_completion(&done.completion);
> > return done.ret;
> > }
> >
>
> I agree to use cond_resched(). https://lkml.org/lkml/2016/9/12/1228
>
> so we really don't need "if defined(CONFIG_PREEMPT_NONE)"?
> I also think without the "if defined(CONFIG_PREEMPT_NONE)",
> the code is more clean,and the logic is still ok.
You really don't need the #ifdef, look at the actual code, not the
Kconfig language.
Powered by blists - more mailing lists