Re: [PATCH 3/4] sched: Pull preemption disablement to __schedule() caller

From: Peter Zijlstra
Date: Wed Feb 04 2015 - 12:48:58 EST


On Wed, Feb 04, 2015 at 06:31:57PM +0100, Frederic Weisbecker wrote:

> > In any case; if we make __schedule() noinline (I think that might make
> > sense) that function call would itself imply the compiler barrier and
> > something like:
> >
> > __preempt_count_add(PREEMPT_ACTIVE + PREEMPT_CHECK_OFFSET);
> > __schedule();
> > __preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_CHECK_OFFSET);
> >
> > Would actually be safe/correct.
> >
> > As it stands I think __schedule() would fail the GCC inline static
> > criteria for being too large, but you never know, noinline guarantees it
> > will not.
>
> Right, although relying only on __schedule() as a function call is perhaps
> error-prone in case we add things in preempt_schedule*() APIs later, before
> the call to __schedule(), that need the preempt count to be visible.
>
> I can create preempt_active_enter() / preempt_active_exit() that take care
> of the preempt op and the barrier() for example.

Sure, like that exception_enter() in preempt_schedule_context() for
instance?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/