lkml.org 
[lkml]   [2018]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: write_lock_irq(&tasklist_lock)
On Tue, May 22, 2018 at 2:17 PM Peter Zijlstra <peterz@infradead.org> wrote:

> qrwlock is a fair lock and should not exhibit writer starvation.

We actually have a special rule to make it *not* be fair, in that
interrupts are allowed to take the read lock if there are readers - even if
there are waiting writers.

I'm not sure how much of an fairness effect this has, but it's required
because of our rule that you can take it for reading without disabling
interrupts.

See

void queued_read_lock_slowpath(struct qrwlock *lock)

in kernel/locking/qrwlock.c.

> You basically want to spin-wait with interrupts enabled, right?

That was the intent of my (untested) pseudo-code. It should work fine. Note
that I used write_trylock() only, so there is no queueing (which also
implies no fairness).

I'm not saying it's a _good_ idea. I'm saying it might work if all you
worry about is the irq-disabled part.

Linus

\
 
 \ /
  Last update: 2018-05-22 23:33    [W:0.294 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site