Re: [PATCH v8 5/5] locking/qspinlock: Introduce the shuffle reduction optimization into CNA

From: Peter Zijlstra
Date: Wed Jan 22 2020 - 04:56:47 EST


On Mon, Dec 30, 2019 at 02:40:42PM -0500, Alex Kogan wrote:
> @@ -251,8 +281,11 @@ __always_inline u32 cna_pre_scan(struct qspinlock *lock,
> struct cna_node *cn = (struct cna_node *)node;
>
> cn->pre_scan_result =
> - cn->intra_count == intra_node_handoff_threshold ?
> - FLUSH_SECONDARY_QUEUE : cna_scan_main_queue(node, node);
> + (node->locked <= 1 && probably(SHUFFLE_REDUCTION_PROB_ARG)) ?
> + PASS_LOCK_IMMEDIATELY :
> + cn->intra_count == intra_node_handoff_threshold ?
> + FLUSH_SECONDARY_QUEUE :
> + cna_scan_main_queue(node, node);
>
> return 0;
> }

Let me just, once again, remind people that the Linux Kernel is not part
of the Obfuscated C code contest.

> Reviewed-by: Steve Sistare <steven.sistare@xxxxxxxxxx>

Seriously, in what universe is that actually readable code? Steve quick,
say what it does.