mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: manfred@colorfullife.com
To: linux-kernel@vger.kernel.org
To: linux-kernel@vger.kernel.org
Cc: Manfred Spraul <manfred@colorfullife.com>
Subject: [PATCH 4/7] ipc/sem.c: optimize if semops fail
Date: Sat,  3 Oct 2009 19:19:21 +0200	[thread overview]
Message-ID: <1254590364-2876-2-git-send-email-manfred@colorfullife.com> (raw)
In-Reply-To: <1254590364-2876-1-git-send-email-manfred@colorfullife.com>

From: Manfred Spraul <manfred@colorfullife.com>

Reduce the amount of scanning of the list of pending semaphore operations:
If try_atomic_semop failed, then no changes were applied. Thus no need to
restart.
Additionally, this patch correct an incorrect comment:
It's possible to wait for arbitrary semaphore values (do a dec by <x>,
wait-for-zero, inc by <x> in one atomic operation)

Both changes are from Nick Piggin, the patch is the result of a different
split of the individual changes.

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
---
 ipc/sem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index 3629ef8..9425817 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -444,13 +444,13 @@ again:
 		 * of the completed operation:
 		 * - if the operation modified the array, then restart from the
 		 *   head of the queue and check for threads that might be
-		 *   waiting for semaphore values to become 0.
+		 *   waiting for the new semaphore values.
 		 * - if the operation didn't modify the array, then just
 		 *   continue.
 		 */
 		alter = q->alter;
 		wake_up_sem_queue(q, error);
-		if (alter)
+		if (alter && !error)
 			goto again;
 	}
 }
-- 
1.6.2.5


  reply	other threads:[~2009-10-03 17:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-03 17:19 [PATCH 0/7] ipc/sem.c: Performance updates manfred
2009-10-03 17:19 ` manfred [this message]
2009-10-03 17:19   ` [PATCH 5/7] ipc/sem.c: add a per-semaphore pending list manfred
2009-10-03 17:19     ` [PATCH 6/7] ipc/sem.c: optimize single semop operations manfred
2009-10-03 17:19       ` [PATCH 7/7] ipc/sem.c: optimize single sops when semval is zero manfred

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=1254590364-2876-2-git-send-email-manfred@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®