Re: [PATCH] locking/rwlocks: do not starve writers
From: Eric W. Biederman
Date: Tue Jun 21 2022 - 12:55:48 EST
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:
> On Fri, Jun 17, 2022 at 2:39 PM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>>
>> I am converting RAW sockets to RCU.
>
> RCU is usually absolutely the best approach. Use regular spinlocks for
> writers, and RCU for readers.
>
> 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.
Well sort of. I converted proc many many years ago.
Like Peter mentioned the big obvious challenge for converting
signal delivery to something else is the atomic delivery aspect.
I am playing with it, and I think I see how to convert signal delivery.
Something like a quick grab of lock that updates struct pid and creates
a list of signals are pending to be delivered. Plus code that forces
clone to deliver the pending signal before clone creates a new task.
Plus something like a generation counter so I can see when pulling the
signal in clone if the signal has already been delivered.
I think tasks exiting before getting a signal is ok, and does not need
any code.
I have some patches that are almost working that can use siglock to
protect the parent/child/ptrace relation ship for SIGCHLD processing.
Which will remove the pressure on tasklist_lock when I get them sorted.
Not that any of this will kill tasklist_lock but with a little luck we
can get to short deterministic hold times.
Eric