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: Sat, 15 Aug 2009 06:52:37 +0200 [thread overview]
Message-ID: <20090815045237.GC19195@wotan.suse.de> (raw)
In-Reply-To: <200908141946.n7EJkh7B018160@mail.q-ag.de>
On Fri, Aug 14, 2009 at 09:16:00PM +0200, Manfred Spraul wrote:
> An alternative patch to Nick's proposal:
> http://lkml.org/lkml/2009/8/11/11
> The patch is based on Nick's patch.
>
> The patch is ontop of the first three patches from Nick.
>
> Identical with Nick's patch:
> - per semaphore list to optimize single sop semop calls:
> This avoids that the semaphore operations have to scan through all waiting
> tasks, even for the tasks that are waiting on a different semaphore from
> the same array.
>
> Differences:
> - same code for per-semaphore and global list.
> - one list for both wait-for-zero and decrement instead of two lists.
> - unlink_queue helper function
>
> Open points:
> - further testing
> - understand all changes. e.g. why switch from "if (alter)" to
> "if (alter & !error)" in update_queue
>
> >From the diffstat, it's simpler: 50 new lines instead of 110 new lines.
>
> Nick: What do you think? Could you try your test app?
The problem with using the same algorithm is that we don't need to
"restart scanning" the simple-op lists when one of them succeeds.
This is because if a negative op fails, then no amount of subsequent
simple negative ops will make it succeed.
With multi-ops, it can be adding and subtracting and waiting for
zero of different sems etc, so in order to try to stay strictly
FIFO, then we always have to recheck all previous failed ops after
one succeeds.
The other problem is that we have to scan all ops in the multi-op
list because we don't know what combination of sem values might
allow the op to succeed. With the single-op lists, we know if the
semval is 0, then we don't have to scan the negative list, and if
it is non-0 then we don't have to scan the zero list.
Combine these two problems and that is where the O(n^2) behaviour
comes in to the complex-op algorithm.
next prev parent reply other threads:[~2009-08-15 4:52 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 [this message]
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
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=20090815045237.GC19195@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