mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Mason <chris.mason@oracle.com>,
	Zach Brown <zach.brown@oracle.com>,
	Jens Axboe <jens.axboe@oracle.com>, Nick Piggin <npiggin@suse.de>,
	Manfred Spraul <manfred@colorfullife.com>
Subject: [PATCH 3/3] [PATCH] ipc/sem.c: cacheline align the ipc spinlock for semaphores
Date: Wed, 28 Apr 2010 21:06:28 +0200	[thread overview]
Message-ID: <1272481588-1941-4-git-send-email-manfred@colorfullife.com> (raw)
In-Reply-To: <1272481588-1941-3-git-send-email-manfred@colorfullife.com>

This patch cacheline aligns the spinlock for sysv semaphores:
Without the patch, the spinlock and sem_otime [written by
every semop that modified the array] and sem_base [read in the
hot path of try_atomic_semop()] can be in the same cacheline.

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
---
 include/linux/sem.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/linux/sem.h b/include/linux/sem.h
index 8a4adbe..f2961af 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -79,6 +79,7 @@ struct  seminfo {
 #ifdef __KERNEL__
 #include <asm/atomic.h>
 #include <linux/rcupdate.h>
+#include <linux/cache.h>
 
 struct task_struct;
 
@@ -91,7 +92,8 @@ struct sem {
 
 /* One sem_array data structure for each set of semaphores in the system. */
 struct sem_array {
-	struct kern_ipc_perm	sem_perm;	/* permissions .. see ipc.h */
+	struct kern_ipc_perm	____cacheline_aligned_in_smp
+				sem_perm;	/* permissions .. see ipc.h */
 	time_t			sem_otime;	/* last semop time */
 	time_t			sem_ctime;	/* last change time */
 	struct sem		*sem_base;	/* ptr to first semaphore in array */
-- 
1.6.6.1


  reply	other threads:[~2010-04-28 19:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 19:06 [PATCH 0/3] ipc/sem.c: Optimization for reducing spinlock contention Manfred Spraul
2010-04-28 19:06 ` [PATCH 1/2] ipc/sem.c: Optimize update_queue() for bulk wakeup calls Manfred Spraul
2010-04-28 19:06   ` [PATCH 2/2] ipc/sem.c: move wake_up_process out of the spinlock section Manfred Spraul
2010-04-28 19:06     ` Manfred Spraul [this message]
2010-05-11 21:21     ` Andrew Morton
2010-05-12 17:34       ` Manfred Spraul
2010-05-12 18:18         ` Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2010-04-18 17:07 [RFC PATCH 0/3] ipc/sem.c: Optimization for reducing spinlock contention Manfred Spraul
2010-04-18 17:07 ` [PATCH 1/3] [PATCH] ipc/sem.c: Optimize update_queue() for bulk wakeup calls Manfred Spraul
2010-04-18 17:07   ` [PATCH 2/3] [PATCH] ipc/sem.c: move wake_up_process out of the spinlock section Manfred Spraul
2010-04-18 17:07     ` [PATCH 3/3] [PATCH] ipc/sem.c: cacheline align the ipc spinlock for semaphores 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=1272481588-1941-4-git-send-email-manfred@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris.mason@oracle.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --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

all inboxes | Powered by JetHome®