From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756725AbcIMIqC (ORCPT ); Tue, 13 Sep 2016 04:46:02 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:50687 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752456AbcIMIqB (ORCPT ); Tue, 13 Sep 2016 04:46:01 -0400 Date: Tue, 13 Sep 2016 10:45:52 +0200 From: Peter Zijlstra To: Cheng Chao Cc: mingo@kernel.org, oleg@redhat.com, tj@kernel.org, akpm@linux-foundation.org, chris@chris-wilson.co.uk, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Message-ID: <20160913084552.GG5008@twins.programming.kicks-ass.net> References: <1473408834-6122-1-git-send-email-chengchao@kedacom.com> <1473497532-5440-1-git-send-email-cs.os.kernel@gmail.com> <20160912113727.GQ10153@twins.programming.kicks-ass.net> <20160912114108.GP10168@twins.programming.kicks-ass.net> <54e0445d-87a5-2eb3-2a7e-7521bc58f095@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54e0445d-87a5-2eb3-2a7e-7521bc58f095@gmail.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.