lkml.org 
[lkml]   [2013]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 4/4] sched: Consolidate open coded preemptible() checks
On Mon, Jul 01, 2013 at 01:20:20PM +0200, Frederic Weisbecker wrote:
> On Wed, Jun 26, 2013 at 03:05:11PM +0200, Peter Zijlstra wrote:
> > On Thu, Jun 20, 2013 at 10:45:41PM +0200, Frederic Weisbecker wrote:
> > > preempt_schedule() and preempt_schedule_context() open
> > > code their preemptability checks.
> > >
> > > Use the standard API instead for consolidation.
> > >
> > > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > > Cc: Ingo Molnar <mingo@kernel.org>
> > > Cc: Li Zhong <zhong@linux.vnet.ibm.com>
> > > Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Cc: Peter Zijlstra <peterz@infradead.org>
> > > Cc: Steven Rostedt <rostedt@goodmis.org>
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: Borislav Petkov <bp@alien8.de>
> > > Cc: Alex Shi <alex.shi@intel.com>
> > > Cc: Paul Turner <pjt@google.com>
> > > Cc: Mike Galbraith <efault@gmx.de>
> > > Cc: Vincent Guittot <vincent.guittot@linaro.org>
> > > ---
> > > kernel/context_tracking.c | 3 +--
> > > kernel/sched/core.c | 4 +---
> > > 2 files changed, 2 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> > > index 6667700..08db730 100644
> > > --- a/kernel/context_tracking.c
> > > +++ b/kernel/context_tracking.c
> > > @@ -88,10 +88,9 @@ void user_enter(void)
> > > */
> > > void __sched notrace preempt_schedule_context(void)
> > > {
> > > - struct thread_info *ti = current_thread_info();
> > > enum ctx_state prev_ctx;
> > >
> > > - if (likely(ti->preempt_count || irqs_disabled()))
> > > + if (likely(!preemptible()))
> > > return;
> > >
> >
> > #ifdef CONFIG_PREEMPT_COUNT
> > # define preemptible() (preempt_count() == 0 && !irqs_disabled())
> > #else
> > # define preemptible() 0
> > #endif
> >
> >
> > Wouldn't that give a problem for !PREEMPT_COUNT?
>
> preempt_schedule_context() depends on CONFIG_PREEMPT which depends on
> CONFIG_PREEMPT_COUNT, so that should work. Or I missed something?

Ah indeed. I just tripped over the fact that its weird to not test
irqs_disabled() even though we don't have the preempt count.




\
 
 \ /
  Last update: 2013-07-01 15:21    [W:0.236 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site