lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 02/11] sched: Create preempt_count invariant
    On Tue, Sep 29, 2015 at 02:55:13PM +0200, Frederic Weisbecker wrote:
    > On Tue, Sep 29, 2015 at 11:28:27AM +0200, Peter Zijlstra wrote:
    > > #define init_task_preempt_count(p) do { \
    > > - task_thread_info(p)->preempt_count = PREEMPT_DISABLED; \
    > > + task_thread_info(p)->preempt_count = 2*PREEMPT_DISABLED; \
    >
    > Since it's not quite obvious why we use this magic value without looking
    > at schedule_tail() details, maybe add a little comment? (Just "/* see schedule_tail() */").

    Right, I fixed that in 12/11 v2. I'll change that around a bit.

    > > + /*
    > > + * Still have preempt_count() == 2, from:
    > > + *
    > > + * schedule()
    > > + * preempt_disable(); // 1
    > > + * __schedule()
    > > + * raw_spin_lock_irq(&rq->lock) // 2
    > > + */
    >
    > I found that a bit confusing first, because that's a preempt_count()
    > we actually emulate for a new task. Maybe something like:
    >
    > + /*
    > + * New task is init with preempt_count() == 2 because prev task left
    > + * us after:
    > + *
    > + * schedule()
    > + * preempt_disable(); // 1
    > + * __schedule()
    > + * raw_spin_lock_irq(&rq->lock) // 2
    > + */

    I think I'll move the comment to finish_task_switch(), but yes.


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