From: Nick Piggin <npiggin@suse.de>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: 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] [patch 4a/4] ipc: sem optimise simple operations
Date: Mon, 17 Aug 2009 08:44:46 +0200 [thread overview]
Message-ID: <20090817064446.GD9962@wotan.suse.de> (raw)
In-Reply-To: <4A87ED93.5060104@colorfullife.com>
On Sun, Aug 16, 2009 at 01:29:23PM +0200, Manfred Spraul wrote:
> On 08/16/2009 12:31 PM, Nick Piggin wrote:
> >On Sat, Aug 15, 2009 at 06:32:14PM +0200, Manfred Spraul wrote:
> >
> >>It depends. After disabling inlining, including all helper functions
> >>that differ:
> >>
> >>My proposal: 301 bytes for update_queue.
> >>
> >>"simple", only negv: 226 bytes
> >>"simple, negv+zero: 354 bytes
> >>simple+complex: 526 bytes.
> >>
> >>Thus with only +-1 simple ops, your version uses less icache. If both
> >>+-1 and 0 ops are used, your version uses more icache.
> >>
> >Don't forget that in that case, your version is badly suboptimal
> >due to the algorithmic complexity.
> >
> I know, I mentioned it in the change log:
> Waking up one "decrement by one" task is O(1) with your code and
> O(1+<number of waiting-for-zero tasks>) with my code.
>
> This is the price paid for saving memory:
> Your version keeps three pointers per semaphore (waiting-for-zero,
> oldest decrement, newest decrement)
> My version keeps only two pointers (newest decrement, waiting-for-zero).
> The "oldest decrement" is reconstructed on the fly, and that operation
> is O(<number of waiting-for-zero tasks>).
OK, well let's just get something in.
I kind of liked to optimise both cases because it took this long to
uncover this suboptimal behaviour (and the problem isn't even
completely due to suboptimal semaphore but also userspace contention),
so even if there are some workloads with a little problem I don't know
if they will ever get reported/diagnosed.
That said, I'm not too unhappy with your version if you feel strongly
about it.
Thanks for reviewing the other patches too.
next prev parent reply other threads:[~2009-08-17 6:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-14 19:16 [PATCH] [patch 4a/4] ipc: sem optimise simple operations Manfred Spraul
2009-08-15 4:52 ` Nick Piggin
2009-08-15 10:10 ` Manfred Spraul
2009-08-15 10:38 ` Nick Piggin
[not found] ` <4A86ABF0.2070207@colorfullife.com>
2009-08-15 14:49 ` Nick Piggin
2009-08-15 16:32 ` Manfred Spraul
2009-08-16 4:53 ` Nick Piggin
2009-08-16 5:12 ` Nick Piggin
2009-08-16 10:31 ` Nick Piggin
2009-08-16 11:29 ` Manfred Spraul
2009-08-17 6:44 ` Nick Piggin [this message]
2009-08-17 13:02 ` Manfred Spraul
2009-08-17 13:10 ` Nick Piggin
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=20090817064446.GD9962@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 \
/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