From: Peter Zijlstra <peterz@infradead.org>
To: Salman <sqazi@google.com>
Cc: akpm@linux-foundation.org, mingo@elte.hu,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] Introduce a config option that introduces a bias in favour of writers in rwlocks
Date: Sat, 22 May 2010 15:36:57 +0200 [thread overview]
Message-ID: <1274535417.5605.23306.camel@twins> (raw)
In-Reply-To: <20100522023744.16767.81170.stgit@bumblebee1.mtv.corp.google.com>
On Fri, 2010-05-21 at 19:38 -0700, Salman wrote:
> If one or more readers are holding the lock, and one or more writers
> are contending for it, then do not admit any new readers. However,
> if a writer is holding a lock, then let readers contend for it at
> equal footing with the writers.
>
> This fixes a pathological case (see the code below), where the
> tasklist_lock is continuously held by the readers, and the writers starve.
>
> The change does not introduce any unexpected test failures in the locking
> self-test. Furthermore, it makes the original problem go away. In
> particular, after the change, the following code can run without
> causing a lockup:
So how does this work with recursion?
rwlock_t is assumed recursive and quite a lot of code relies on that.
CPU0 CPU1
read_lock(&A)
write_lock_irq(&A)
<IRQ>
read_lock(&A) <-- deadlock because there's a pending writer
Also, I really think having config options for lock behaviour is utter
suckage, either a new implementation is better or its not.
If you want your waitpid() case to work better, try converting its
tasklist_lock usage to RCU, or try and break the lock into smaller
locks.
NAK on both your patch and your approach, rwlock_t should be killed off,
not 'improved'.
prev parent reply other threads:[~2010-05-22 13:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-22 2:38 Salman
2010-05-22 13:36 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1274535417.5605.23306.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sqazi@google.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®