On Wed, Jul 22, 2020 at 04:45:36PM -0700, Peter Oskolkov wrote: > This patchset is the first step to open-source this work. As explained > in the linked pdf and video, SwitchTo API has three core operations: wait, > resume, and swap (=switch). So this patchset adds a FUTEX_SWAP operation > that, in addition to FUTEX_WAIT and FUTEX_WAKE, will provide a foundation > on top of which user-space threading libraries can be built.
The PDF and video can go pound sand; you get to fully explain things here. What worries me is how FUTEX_SWAP would interact with the future FUTEX_LOCK / FUTEX_UNLOCK. When we implement pthread_mutex with those, there's very few WAIT/WAKE left. Also, why would we commit to an ABI without ever having seen the rest? On another note: wake_up_process_prefer_current_cpu() is a horrific function name :/ That's half to a third of the line limit.