From: Peter Zijlstra <peterz@infradead.org>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
linux-arch@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org,
Alexander Graf <agraf@suse.de>, Paul Mackerras <paulus@samba.org>,
David Vrabel <david.vrabel@citrix.com>,
xen-devel@lists.xenproject.org,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 3/3] sched/preempt: fix cond_resched_lock() and cond_resched_softirq()
Date: Wed, 15 Jul 2015 15:35:07 +0200 [thread overview]
Message-ID: <20150715133507.GR19282@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <55A65792.80903@yandex-team.ru>
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!
next prev parent reply other threads:[~2015-07-15 13:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 9:52 [PATCH v2 1/3] drivers/xen/preempt: use need_resched() instead of should_resched() Konstantin Khlebnikov
2015-07-15 9:52 ` Konstantin Khlebnikov
2015-07-15 9:52 ` [PATCH v2 2/3] KVM: PPC: Book3S HV: Use " Konstantin Khlebnikov
2015-07-15 9:52 ` Konstantin Khlebnikov
2015-07-15 9:52 ` [PATCH v2 3/3] sched/preempt: fix cond_resched_lock() and cond_resched_softirq() Konstantin Khlebnikov
2015-07-15 9:52 ` Konstantin Khlebnikov
2015-07-15 12:16 ` Eric Dumazet
2015-07-15 12:52 ` Konstantin Khlebnikov
2015-07-15 13:35 ` Peter Zijlstra [this message]
2015-07-20 13:41 ` [Xen-devel] [PATCH v2 1/3] drivers/xen/preempt: use need_resched() instead of should_resched() David Vrabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150715133507.GR19282@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=agraf@suse.de \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=eric.dumazet@gmail.com \
--cc=khlebnikov@yandex-team.ru \
--cc=kvm-ppc@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox