mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linas@austin.ibm.com
To: Anton Blanchard <anton@samba.org>
Cc: linux-kernel@vger.kernel.org, davem@redhat.com, mingo@redhat.com,
	riel@redhat.com, mranweil@us.ibm.com
Subject: Re: PATCH: kernel-2.4 brlock livelock
Date: Wed, 3 Sep 2003 15:10:44 -0500	[thread overview]
Message-ID: <20030903151043.B51004@forte.austin.ibm.com> (raw)
In-Reply-To: <20030903194401.GA688@krispykreme>; from anton@samba.org on Thu, Sep 04, 2003 at 05:44:02AM +1000

On Thu, Sep 04, 2003 at 05:44:02AM +1000, Anton Blanchard wrote:
> 
> Hi,
> 
> > The patch changes the non-atomic code. It grabs the write lock, and
> > then spins, waiting for all of the existing readers to finish. 
> > New readers are held off.  This seems (to me) to be a reasonable 
> > thing to do, based on the following logic:
> 
> The problem is with recursive readers. One cpu takes a br read lock then
> wants to take the same lock again. It must be allowed to get that read lock.
> 
> We need to drop the write spinlock or else we will deadlock.

Whoops. 

OK, how about the following: readers on a given cpu are held off 
if the write lock is held *and* the read-count on that cpu is zero?

That way, 'recursive' readers on other CPU's can get a read-lock if
there's already a non-zero read-lock-count on that CPU.   

That should work if the thread holding the lock can't get scheduled
to another cpu.  Can these things wander around?

If they can wander around, then oone would have to order the cpus:
wait for read count to drop to zero on cpu 0 then on 1 then on 2, 
meanwhile the read-lock can be gotten on the higher ordered CPUs ...

If this sounds reasonable, would you care to see a revised patch?

What else can go wrong?

--linas

  reply	other threads:[~2003-09-03 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-03 19:21 linas
2003-09-03 19:44 ` Anton Blanchard
2003-09-03 20:10   ` linas [this message]
2003-09-04  8:59     ` Ingo Molnar

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=20030903151043.B51004@forte.austin.ibm.com \
    --to=linas@austin.ibm.com \
    --cc=anton@samba.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mranweil@us.ibm.com \
    --cc=riel@redhat.com \
    /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®