summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorManfred Spraul <manfred@colorfullife.com>2013-07-08 16:01:22 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-18 07:45:47 -0700
commit0824e44c3f0aa0d5dc3d06910a09b9bbaa53d2f6 (patch)
treebd9571fa2d0919a24675acc3623bbaba48f53110 /ipc
parent49f7f31ab27de9bcaf2d12e1d0196400dadf6add (diff)
downloadlinux-3.10-0824e44c3f0aa0d5dc3d06910a09b9bbaa53d2f6.tar.gz
linux-3.10-0824e44c3f0aa0d5dc3d06910a09b9bbaa53d2f6.tar.bz2
linux-3.10-0824e44c3f0aa0d5dc3d06910a09b9bbaa53d2f6.zip
ipc/sem.c: cacheline align the semaphore structures
commit f5c936c0f267ec58641451cf8b8d39b4c207ee4d upstream. As now each semaphore has its own spinlock and parallel operations are possible, give each semaphore its own cacheline. On a i3 laptop, this gives up to 28% better performance: #semscale 10 | grep "interleave 2" - before: Cpus 1, interleave 2 delay 0: 36109234 in 10 secs Cpus 2, interleave 2 delay 0: 55276317 in 10 secs Cpus 3, interleave 2 delay 0: 62411025 in 10 secs Cpus 4, interleave 2 delay 0: 81963928 in 10 secs -after: Cpus 1, interleave 2 delay 0: 35527306 in 10 secs Cpus 2, interleave 2 delay 0: 70922909 in 10 secs <<< + 28% Cpus 3, interleave 2 delay 0: 80518538 in 10 secs Cpus 4, interleave 2 delay 0: 89115148 in 10 secs <<< + 8.7% i3, with 2 cores and with hyperthreading enabled. Interleave 2 in order use first the full cores. HT partially hides the delay from cacheline trashing, thus the improvement is "only" 8.7% if 4 threads are running. Signed-off-by: Manfred Spraul <manfred@colorfullife.com> Cc: Rik van Riel <riel@redhat.com> Cc: Davidlohr Bueso <davidlohr.bueso@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/sem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index d3ad3573bc6..8498b67a3b6 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -96,7 +96,7 @@ struct sem {
int sempid; /* pid of last operation */
spinlock_t lock; /* spinlock for fine-grained semtimedop */
struct list_head sem_pending; /* pending single-sop operations */
-};
+} ____cacheline_aligned_in_smp;
/* One queue for each sleeping process in the system. */
struct sem_queue {