mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>
Subject: Re: [x86] Unify semaphore_32.S and rwlock_64.S
Date: Wed, 20 Jan 2010 15:57:13 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1001201546330.13231@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.2.00.1001201443340.17915@router.home>



On Wed, 20 Jan 2010, Christoph Lameter wrote:
> 
> Well 2^32 readers is a bit large anyways. If we are satisifed with 2^30
> (only a billion) then it works with the same code.

Yes, that's what I would suggest. Make the constants be (for the 64-bit 
case)

	#define RWSEM_UNLOCKED_VALUE            0x00000000
	#define RWSEM_ACTIVE_BIAS               0x00000001
	#define RWSEM_ACTIVE_MASK               0x3fffffff
	#define RWSEM_WAITING_BIAS              (~RWSEM_ACTIVE_MASK)
	#define RWSEM_ACTIVE_READ_BIAS          RWSEM_ACTIVE_BIAS
	#define RWSEM_ACTIVE_WRITE_BIAS         (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
	
and now all the constants should be expressable as 32-bit (signed) values.

Side note: it might be interesting to keep the rwsem_count_t be a config 
option on x86-64 too, so this would _not_ necessarily always be a "x86-32" 
vs "x86-64" issue. A raw spinlock is 32-bit, which together with a 32-bit 
rwsem_count would make the resem's smaller. Does it matter? Maybe not. But 
we might at some point decide that it's worth limiting number of threads 
to 32k in certain configurations, so I'd keep my options open.

So make the size of the counter be a CONFIG_RWSEM_LARGE thing, rather than 
a 32-bit vs 64-bit thing. And just start out with making x86-64 select it, 
but leaving the option open to use the 32-bit version on x86-64 too?

			Linus

  reply	other threads:[~2010-01-20 23:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19 22:21 Christoph Lameter
2010-01-19 22:30 ` H. Peter Anvin
2010-01-20 19:49   ` Christoph Lameter
2010-01-20 20:14     ` H. Peter Anvin
2010-01-20 20:51       ` Christoph Lameter
2010-01-20 23:57         ` Linus Torvalds [this message]
2010-01-21  0:02           ` H. Peter Anvin
2010-01-21  6:28             ` H. Peter Anvin
2010-01-21  0:46           ` Linus Torvalds
2010-01-21  0:55             ` H. Peter Anvin
2010-01-20 23:46       ` Linus Torvalds

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=alpine.LFD.2.00.1001201546330.13231@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=cl@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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®