Re: [PATCH tip/locking/core v9 2/6] locking/qspinlock: prefetch next node cacheline

From: Peter Zijlstra
Date: Thu Nov 05 2015 - 11:50:08 EST


On Thu, Nov 05, 2015 at 11:42:27AM -0500, Waiman Long wrote:
> If we observe next, we will observe val != tail sooner or later. It is not
> possible for it to clear the tail code in the lock. The tail xchg will
> guarantee that.
>
> Another alternative is to do something like
>
> + if (!next)
> while (!(next = READ_ONCE(node->next)))
> cpu_relax();
>

Yes maybe, although the main reason I fell over this was because it was
a separate change (and not mentioned in the Changelog).

Although the above would need braces (per CodingStyle), so:

if (!next) {
while (!(next = READ_ONCE(node->next)))
cpu_relax();
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/