Re: [PATCH 1/2] sched/wait: Break up long wake list walk

From: Andi Kleen
Date: Fri Aug 18 2017 - 16:05:32 EST


> I was really hoping that we'd root-cause this and have a solution (and
> then apply Tim's patch as a "belt and suspenders" kind of thing), but

One thing I wanted to point out is that Tim's patch seems to make
several schedule intensive micro benchmarks faster.

I think what's happening is that it allows more parallelism during wakeup:

Normally it's like

CPU 1 CPU 2 CPU 3 .....

LOCK
wake up tasks on other CPUs woken up woken up
UNLOCK SPIN on waitq lock SPIN on waitq lock
LOCK
remove waitq
UNLOCk
LOCK
remove waitq
UNLOCK

So everything is serialized.

But with the bookmark patch the other CPUs can go through the "remove waitq" sequence
earlier because they have a chance to get a go at the lock and do it in parallel
with the main wakeup.

Tim used a 64 task threshold for the bookmark. That may be actually too large.
It may even be faster to use a shorter one.

So I think it's more than a bandaid, but likely a useful performance improvement
even for less extreme wait queues.

-Andi