Re: [PATCH] locking/rwlocks: do not starve writers

From: Peter Zijlstra
Date: Mon Jun 20 2022 - 03:25:33 EST


On Fri, Jun 17, 2022 at 02:48:08PM -0500, Linus Torvalds wrote:

> I'd love to see the tasklist_lock be converted to RCU too. But that
> locks predates RCU (and probably 99% of all kernel code), and it's
> messy, so nobody sane has ever willingly tried to do that afaik.

Thomas actually tried a few years ago (for RT, which also hates on RW
type locks). At the time he converted most users to RCU (since the
tasklist itself is also RCU protected), but there's a bunch of users
(more than you'd like) that really need to be exclusive vs fork.

IIRC the most prominent problem is that RCU iteration can miss incoming
tasks and they'll miss getting updated. But like said, it's a few years
ago so I'm a bit hazy on the details.