Re: [PATCH v2 0/9] Remove spin_unlock_wait()
From: Ingo Molnar
Date: Fri Jul 07 2017 - 06:34:16 EST
* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> You missed the one in do_exit(), which I thought was the original one.
Indeed, it's raw_spin_unlock_wait() which my git grep pattern missed.
But it's not the original spin_unlock_wait(): the pi_lock and priority inheritance
is a newfangled invention that Linus (rightfully) resisted for years.
The original spin_unlock_wait() was for the global scheduler_lock, long gone.
Here's the full history of the original spin_unlock_wait() usecase in the
do_exit() path, for the historically interested:
[1997/04] v2.1.36:
the spin_unlock_wait() primitive gets introduced as part of release()
[1998/08] v2.1.114:
the release() usecase gets converted to an open coded spin_lock()+unlock()
poll loop over scheduler_lock
[1999/05] v2.3.11pre3:
open coded loop is changed over to poll p->has_cpu
[1999/07] v2.3.12pre6:
->has_cpu loop poll loop is converted to a spin_lock()+unlock()
poll loop over runqueue_lock
[2000/06] 2.4.0-test6pre4:
combined open coded p->has_cpu poll loop is added back, in addition to the
lock()+unlock() loop
[2000/11] 2.4.0-test12pre4:
lock+unlock loop is changed from scheduler_lock to task_lock
[2001/11] v2.4.14.9:
->has_cpu gets renamed to ->cpus_runnable
[2001/12] v2.5.1.10:
poll loop is factored out from exit()'s release() function
to the scheduler's new wait_task_inactive() function
...
[2017/07] v4.12:
wait_task_inactive() is still alive and kicking. Its poll loop has
increased in complexity, but it still does not use spin_unlock_wait()
So it was always a mess, and we relatively early flipped from the clever
spin_unlock_wait() implementation to an open coded lock+unlock poll loop.
TL;DR: The original do_exit() usecase is gone, it does not use spin_unlock_wait(),
since 1998.
Thanks,
Ingo