public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Zach Brown <zach.brown@oracle.com>
Cc: Manfred Spraul <manfred@colorfullife.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nadia Derbey <Nadia.Derbey@bull.net>,
	Pierre Peiffer <peifferp@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 4/4] ipc: sem optimise simple operations
Date: Wed, 12 Aug 2009 06:07:56 +0200	[thread overview]
Message-ID: <20090812040756.GA5330@wotan.suse.de> (raw)
In-Reply-To: <4A81B728.7040200@oracle.com>

On Tue, Aug 11, 2009 at 11:23:36AM -0700, Zach Brown wrote:
> Manfred Spraul wrote:
> > On 08/11/2009 01:09 PM, npiggin@suse.de wrote:
> >> Index: linux-2.6/include/linux/sem.h
> >> ===================================================================
> >> --- linux-2.6.orig/include/linux/sem.h
> >> +++ linux-2.6/include/linux/sem.h
> >> @@ -86,6 +86,8 @@ struct task_struct;
> >>   struct sem {
> >>       int    semval;        /* current value */
> >>       int    sempid;        /* pid of last operation */
> >> +    struct list_head    negv_pending;
> >> +    struct list_head    zero_pending;
> >>   };
> >>    
> > struct sem is increased from 8 to 24 bytes.
> 
> And larger still with 64bit pointers.

Yes it is a significant growth. To answer Manfed's question, I don't
know if there are applications using large numbers of semaphores per
set. Google search for increase SEMMSL results in mostly Oracle,
which says to use 250 (which is our current default).

A semaphore set with 250 will use 2K before, and 10K afterward. I
don't know that it is a huge amount really, given that they also
have to presumably be *protecting* stuff.

We can convert them to hlists (I was going to send a patch to do
everything in hlists, but hlists are missing some _rcu variants...
maybe I should just convert the pending lists to start with).

 
> If it's a problem, this can be scaled back.  You can have pointers to
> lists and you can have fewer lists.
> 
> Hopefully it won't be a problem, though.  We can close our eyes and
> pretend that the size of the semaphore sets scale with the size of the
> system and that it's such a relatively small consumer of memory that no
> one will notice :).

The other thing is that using semaphores as sets really won't scale
well at all. It will scale better now that there are per-sem lists,
but there is still a per-set lock. They really should be discouraged.

It's not trivial to remove shared cachelines completely. Possible I
think, but I think it would further increase complexity without a
proven need at this point.


  reply	other threads:[~2009-08-12  4:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 11:09 [patch 0/4] ipc sem improvements npiggin
2009-08-11 11:09 ` [patch 1/4] ipc: sem optimise undo list search npiggin
2009-08-16 13:17   ` Manfred Spraul
2009-08-11 11:09 ` [patch 2/4] ipc: sem use list operations npiggin
2009-08-16 13:18   ` Manfred Spraul
2009-08-11 11:09 ` [patch 3/4] ipc: sem preempt improve npiggin
2009-08-16 13:20   ` Manfred Spraul
2009-08-11 11:09 ` [patch 4/4] ipc: sem optimise simple operations npiggin
2009-08-11 18:19   ` Manfred Spraul
2009-08-11 18:23     ` Zach Brown
2009-08-12  4:07       ` Nick Piggin [this message]
2009-08-12 18:35         ` Manfred Spraul
2009-08-14  8:58           ` Nick Piggin
2009-08-14 17:53             ` Manfred Spraul
2009-08-11 20:07   ` Cyrill Gorcunov
2009-08-12  4:48     ` Nick Piggin
2009-08-12  5:43       ` Cyrill Gorcunov
2009-08-14 18:48   ` Manfred Spraul

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=20090812040756.GA5330@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=Nadia.Derbey@bull.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=peifferp@gmail.com \
    --cc=zach.brown@oracle.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