From: Hubertus Franke <frankeh@watson.ibm.com>
To: Joshua MacDonald <jmacd@namesys.com>
Cc: linux-kernel@vger.kernel.org, lse-tech@lists.sourceforge.net
Subject: Re: [PATCH] Lightweight userspace semaphores...
Date: Wed, 27 Feb 2002 17:09:13 -0500 [thread overview]
Message-ID: <20020227170913.A2021@elinux01.watson.ibm.com> (raw)
In-Reply-To: <20020227163834.GF322@reload.nmd.msu.ru> <20020227115842.C1308@elinux01.watson.ibm.com> <20020227173307.GH322@reload.nmd.msu.ru>
In-Reply-To: <20020227173307.GH322@reload.nmd.msu.ru>; from jmacd@namesys.com on Wed, Feb 27, 2002 at 08:33:07PM +0300
To followup on this. I have posted the latest version of this under
http://prdownloads.sourceforge.net/lse/ulocks-2.4.17.tar.bz2
- I followed the suggestion below to minimize ulock_t datastructure
to do so go to ./make.setup and comment out the -DLOCK_STATISTICS flag
this will bring the ulockt_t down to 2 words, otherwise 28 bytes.
- The ulockflex program will irrespectively allocate all locks on cacheline
boundaries regardless of size.
- I fixed a problem in ulockflex that was introduced in the last version.
- I have now number of queues instead of an explicite lock type. Hence
the kernel only knows about number of queues to maintain.
-- Hubertus Franke
On Wed, Feb 27, 2002 at 08:33:07PM +0300, Joshua MacDonald wrote:
> On Wed, Feb 27, 2002 at 11:58:42AM -0500, Hubertus Franke wrote:
> > On Wed, Feb 27, 2002 at 07:38:34PM +0300, Joshua MacDonald wrote:
> > > Hi Hubertus,
> > >
> > > I have a question for you about these semaphores. I took a glance at
> > > <linux/ulocks.h> to try and find out how large an object the
> > > user-space lock is. I see that you have it written like this:
> > >
> > > typedef struct ulock_t {
> > > unsigned long status;
> > > unsigned long type;
> > > unsigned long counters[ULOCK_STAT_COUNTERS];
> > > char pad[SMP_CACHE_BYTES -
> > > (ULOCK_STAT_COUNTERS+2)*sizeof(unsigned long)];
> > > } ulock_t ____cacheline_aligned;
> > >
> > > I would like to suggest that you offer a version of the ulock_t that
> > > is as small as possible so that the user can make use of the entire
> > > cacheline rather than waste it on padding.
> > >
> > > The reason I'm interested is that I have written a concurrent,
> > > cache-optimized skip list and I did all of my testing using the
> > > standard Linux spinlocks. Those are 4 bytes per lock. I use one lock
> > > per cacheline-sized node of the data structure. If you can get your
> > > locks down to one or two words that would be really interesting, since
> > > spinlocks don't work terribly well in user-space. I would really like
> > > to be able to use this data structure outside of the kernel, and your
> > > locks might just solve my problem, but only if they are small enough.
> > >
> > > Do you see my point? You can find my latest skiplist code at:
> >
> > I have seen the light. Seriously, I initially had it as you said, but
> > Linus was strongly recommending cacheline size objects to
> > avoid false sharing other than on the lock word
> > However, there should be no problem whatsoever to bring that back
> > to 2 words.
>
> Sounds good. There is nothing to prevent the declaration of a ulock_t
> variable from using __cacheline_aligned, so I think Linus is off on
> this one.
>
> I'd like to test this out sometime. The SLPC code uses a lots of CPP
> trickery to configure itself with various different read/write or
> exclusive locking packages, so its fairly easy to port to a new
> locking primitive.
>
> -josh
next prev parent reply other threads:[~2002-02-27 22:09 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20020227163834.GF322@reload.nmd.msu.ru>
2002-02-27 16:58 ` Hubertus Franke
[not found] ` <20020227173307.GH322@reload.nmd.msu.ru>
2002-02-27 22:09 ` Hubertus Franke [this message]
2002-02-27 8:43 [PATCH] Lightweight userspace semphores Martin Wirth
2002-02-27 15:24 ` Hubertus Franke
2002-02-27 17:17 ` Martin Wirth
2002-02-27 19:04 ` Hubertus Franke
[not found] ` <3C7FDF76.9040903@dlr.de>
2002-03-02 14:08 ` [PATCH] Lightweight userspace semaphores Hubertus Franke
-- strict thread matches above, loose matches on Subject: below --
2002-02-23 3:47 Rusty Russell
2002-02-23 15:03 ` Ingo Molnar
2002-02-23 18:20 ` Linus Torvalds
2002-02-23 18:28 ` Larry McVoy
2002-02-23 20:31 ` Ingo Molnar
2002-02-23 21:22 ` Alan Cox
2002-02-26 16:09 ` Hubertus Franke
2002-02-24 23:29 ` Rusty Russell
2002-02-24 23:48 ` Linus Torvalds
2002-02-25 1:10 ` Rusty Russell
2002-02-25 1:23 ` Linus Torvalds
2002-02-25 13:14 ` Alan Cox
2002-02-25 16:11 ` Linus Torvalds
2002-02-25 16:39 ` Alan Cox
2002-02-25 16:32 ` Benjamin LaHaise
2002-02-25 17:42 ` Alan Cox
2002-02-25 18:23 ` Hubertus Franke
2002-02-25 20:57 ` Hubertus Franke
2002-02-25 17:06 ` Linus Torvalds
2002-02-25 17:31 ` Alan Cox
2002-02-25 17:20 ` Linus Torvalds
2002-02-25 17:50 ` Alan Cox
2002-02-25 17:44 ` Linus Torvalds
2002-02-25 18:06 ` Alan Cox
2002-02-25 19:31 ` Linus Torvalds
2002-02-24 4:57 ` Daniel Phillips
2002-02-25 19:51 ` Hubertus Franke
2002-03-03 7:07 ` Rusty Russell
2002-03-01 4:56 ` Eric W. Biederman
2002-03-02 14:54 ` Pavel Machek
2002-02-25 15:00 ` Hubertus Franke
2002-03-01 4:44 ` Eric W. Biederman
2002-02-27 0:24 ` Rusty Russell
2002-02-27 15:53 ` Hubertus Franke
2002-03-01 0:24 ` Richard Henderson
2002-03-01 2:00 ` Hubertus Franke
2002-02-27 16:29 ` Hubertus Franke
2002-03-02 14:50 ` Hubertus Franke
2002-03-03 13:30 ` Rusty Russell
2002-03-04 16:51 ` Hubertus Franke
2002-03-05 4:41 ` Rusty Russell
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=20020227170913.A2021@elinux01.watson.ibm.com \
--to=frankeh@watson.ibm.com \
--cc=jmacd@namesys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
/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®