Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753927AbbEKPvm (ORCPT ); Mon, 11 May 2015 11:51:42 -0400 Received: from casper.infradead.org ([85.118.1.10]:57276 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753125AbbEKPvi (ORCPT ); Mon, 11 May 2015 11:51:38 -0400 Date: Mon, 11 May 2015 17:51:25 +0200 From: Peter Zijlstra To: Frederic Weisbecker Cc: LKML , Ingo Molnar , Thomas Gleixner , Linus Torvalds Subject: Re: [PATCH 4/7] preempt: Disable preemption from preempt_schedule*() callers Message-ID: <20150511155125.GX21418@twins.programming.kicks-ass.net> References: <1431356904-4624-1-git-send-email-fweisbec@gmail.com> <1431356904-4624-5-git-send-email-fweisbec@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431356904-4624-5-git-send-email-fweisbec@gmail.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2485 Lines: 70 On Mon, May 11, 2015 at 05:08:21PM +0200, Frederic Weisbecker wrote: > Lets gather the preempt operations (set PREEMPT_ACTIVE and disable > preemption) in a single operation. This way we prepare to remove the > preemption disablement in __schedule() in order to omptimize this > duty on the caller. > > Suggested-by: Linus Torvalds > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Thomas Gleixner > Cc: Linus Torvalds > Signed-off-by: Frederic Weisbecker > --- > include/linux/preempt.h | 12 ++++++++++++ > kernel/sched/core.c | 20 ++++++-------------- > 2 files changed, 18 insertions(+), 14 deletions(-) > > diff --git a/include/linux/preempt.h b/include/linux/preempt.h > index 4689ef2..45da394 100644 > --- a/include/linux/preempt.h > +++ b/include/linux/preempt.h > @@ -137,6 +137,18 @@ extern void preempt_count_sub(int val); > #define preempt_count_inc() preempt_count_add(1) > #define preempt_count_dec() preempt_count_sub(1) > > +#define preempt_active_enter() \ > +do { \ > + preempt_count_add(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \ > + barrier(); \ > +} while (0) > + > +#define preempt_active_exit() \ > +do { \ > + barrier(); \ > + preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \ > +} while (0) > + > #ifdef CONFIG_PREEMPT_COUNT > > #define preempt_disable() \ > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 8027cfd..182127a 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -2859,15 +2859,14 @@ void __sched schedule_preempt_disabled(void) > static void __sched notrace preempt_schedule_common(void) > { > do { > - __preempt_count_add(PREEMPT_ACTIVE); > + preempt_active_enter(); > __schedule(); > - __preempt_count_sub(PREEMPT_ACTIVE); > + preempt_active_exit(); > > /* > * Check again in case we missed a preemption opportunity > * between schedule and now. > */ > - barrier(); > } while (need_resched()); > } So this patch adds a level of preempt_disable; I suspect the goal is to remove the preempt_disable() inside __schedule(), but as it stands this patch is broken, no? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/