lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH v2 12/11] sched: Add preempt_count invariant check
On Tue, Sep 29, 2015 at 07:55:49AM -0400, Linus Torvalds wrote:
> On Tue, Sep 29, 2015 at 6:56 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > + * Initial preempt_count value; reflects the preempt_count schedule invariant
> > + * which states that during schedule preempt_count() == 2.
>
> Is this actually *true*?
>
> preempt_count() is two only if preemption is enabled. But spinlocks do
> not actually update the preemption count if there is no preemption, so
> these kinds of checks and comments that aren't even inside #ifdef
> CONFIG_PREEMPT seem to be actively misleading.
>
> I do believe that the preempt count is stable - but the actual value
> would seem to depend on config options.

Right, 2*PREEMPT_DISABLE_OFFSET is the 'right' number. That ends up
being 0 for !PREEMPT_COUNT configs.

I'll update the Changelog to be more accurate on this.


\
 
 \ /
  Last update: 2015-09-29 14:21    [W:0.086 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site