lkml.org 
[lkml]   [2015]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/3] sched/preempt: fix cond_resched_lock() and cond_resched_softirq()
On Wed, Jul 15, 2015 at 03:52:34PM +0300, Konstantin Khlebnikov wrote:
> On 15.07.2015 15:16, Eric Dumazet wrote:
> >On Wed, 2015-07-15 at 12:52 +0300, Konstantin Khlebnikov wrote:
> >>These functions check should_resched() before unlocking spinlock/bh-enable:
> >>preempt_count always non-zero => should_resched() always returns false.
> >>cond_resched_lock() worked iff spin_needbreak is set.
> >
> >Interesting, this definitely used to work (linux-3.11)
> >
> >Any idea of which commit broke things ?
> >
>
> Searching... done
>
> This one: bdb43806589096ac4272fe1307e789846ac08d7c in v3.13
>
> before
>
> -static inline int should_resched(void)
> -{
> - return need_resched() && !(preempt_count() & PREEMPT_ACTIVE);
> -}
>
> after
>
> +static __always_inline bool should_resched(void)
> +{
> + return unlikely(!*preempt_count_ptr());
> +}

Argh, indeed!

>
> So,
>
> Fixes: bdb438065890 ("sched: Extract the basic add/sub preempt_count
> modifiers")

Thanks!


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