public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: "D . W . Howells" <dhowells@astarte.free-online.co.uk>
Cc: linux-kernel@vger.kernel.org, dhowells@redhat.com,
	torvalds@transmeta.com
Subject: Re: generic rwsem [Re: Alpha "process table hang"]
Date: Wed, 18 Apr 2001 01:06:31 +0200	[thread overview]
Message-ID: <20010418010631.H31982@athlon.random> (raw)
In-Reply-To: <01041722480200.05613@orion.ddi.co.uk>
In-Reply-To: <01041722480200.05613@orion.ddi.co.uk>; from dhowells@astarte.free-online.co.uk on Tue, Apr 17, 2001 at 10:48:02PM +0100

On Tue, Apr 17, 2001 at 10:48:02PM +0100, D . W . Howells wrote:
> I disagree... you want such primitives to be as efficient as possible. The 
> whole point of having asm/xxxx.h files is that you can stuff them full of 
> dirty tricks specific to certain architectures.

Of course you always have the option to override completly and you should
on x86 (providing an API for total override is the main object of my patch).

> I've had a look at your implementation... It seems to hold the spinlocks for 
> an awfully long time... specifically around the local variable initialisation 

My point for not unlocking is that unlocking and locking back another spinlock
for the waitqueue and using the wait_even interface for serializing the slow
path is expensive and generates more cacheline ping pong between cpus.  And
quite frankly I don't care about the scalability of the slow path so if the
slow path is simpler and slower I'm happy with it.

> Your rw_semaphore structure is also rather large: 46 bytes without debugging 

It is 36bytes. and on 64bit archs the difference is going to be less.

> stuff (16 bytes apiece for the waitqueues and 12 bytes for the rest). 

The real waste is the lock of the waitqueue that I don't need, so I should
probably keep two list_head in the waitqueue instead of using the
wait_queue_head_t and wake_up_process by hand.

> Admittedly, though, yours is extremely simple and easy to follow, but I don't 
> think it's going to be very fast.

The fast path has to be as fast as yours, if not then the only variable that
can make difference is the fact I'm not inlining the fast path because it's not
that small, in such a case I should simply inline the fast path, I don't care
about the scalability of the slow path and I think the slow path may even be
faster than yours because I don't run additional unlock/lock and memory
barriers and the other cpus will stop dirtifying my stuff after their first
trylock until I unlock.

If you have time to benchmark I'd be interested to see some number. But anyways
my implementation was mostly meant to be obviously right and possible to
ovverride with per-arch algorithms.

Andrea

  reply	other threads:[~2001-04-17 22:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-17 21:48 generic rwsem [Re: Alpha "process table hang"] D.W.Howells
2001-04-17 23:06 ` Andrea Arcangeli [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-04-17 23:54 D.W.Howells
2001-04-18 20:49 ` Andrea Arcangeli
2001-04-17 19:18 D.W.Howells
2001-04-17 20:49 ` Andrea Arcangeli
2001-04-17 21:29   ` Christoph Hellwig
2001-04-17 22:06     ` Andrea Arcangeli
2001-04-11 17:57 Alpha "process table hang" Bob McElrath
     [not found] ` <E14nOzo-0007Ew-00@the-village.bc.nu>
2001-04-13 13:48   ` Bob McElrath
2001-04-17 15:07     ` generic rwsem [Re: Alpha "process table hang"] Andrea Arcangeli
2001-04-17 15:28       ` Bob McElrath
2001-04-19 16:21         ` Bob McElrath
2001-04-19 17:17           ` Andrea Arcangeli
2001-04-23 23:27             ` Bob McElrath
2001-04-23 23:40               ` Andrea Arcangeli
2001-04-17 15:45       ` Christoph Hellwig
2001-04-17 16:59       ` David Howells
2001-04-17 17:55         ` Andrea Arcangeli

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=20010418010631.H31982@athlon.random \
    --to=andrea@suse.de \
    --cc=dhowells@astarte.free-online.co.uk \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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