Re: [PATCH v2 0/2] arm64: Only call into preempt_schedule() if need_resched()

From: Peter Zijlstra
Date: Thu Dec 06 2018 - 10:09:03 EST


On Fri, Nov 30, 2018 at 05:34:29PM +0000, Will Deacon wrote:
> Hi all,
>
> This is version two of the patches I originally posted here:
>
> http://lkml.kernel.org/r/1543347902-21170-1-git-send-email-will.deacon@xxxxxxx
>
> The only change since v1 is that __preempt_count_dec_and_test() now
> reloads the need_resched flag if it initially saw that it was set. This
> resolves the issue spotted by Peter, where an IRQ coming in during the
> decrement can cause a reschedule to be missed.

Yes, I think this one will work, so:

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>

However, this leaves me wondering if the sequence is actually much
better than what you had?

I suppose there's a win due to cache locality -- you only have to load a
single line -- but I'm thinking that on pure instruction count, you're
not actually winning much.