summaryrefslogtreecommitdiffstats
path: root/include/linux/ipc.h
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2017-05-08 18:57:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-08 20:15:12 -0400
commit60f3e00d25b44e3aa51846590d1e10f408466a83 (patch)
tree3596ddb9b62bef33a4fef3665b38ccc6700884ec /include/linux/ipc.h
parentf0cb88026f51a0d8c952cf5e09e1933ef10b50b4 (diff)
sysv,ipc: cacheline align kern_ipc_perm
Assign 'struct kern_ipc_perm' its own cacheline to avoid false sharing with sysv ipc calls. While the structure itself is rather read-mostly throughout the lifespan of ipc, the spinlock causes most of the invalidations. One example is commit 31a7c4746e9 ("ipc/sem.c: cacheline align the ipc spinlock for semaphores"). Therefore, extend this to all ipc. The effect of cacheline alignment on sems can be seen in sembench, which deals mostly with semtimedop wait/wakes is seen to improve raw throughput (worker loops) between 8 to 12% on a 24-core x86 with over 4 threads. Link: http://lkml.kernel.org/r/1486673582-6979-4-git-send-email-dave@stgolabs.net Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/ipc.h')
-rw-r--r--include/linux/ipc.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 9d84942ae2e5..71fd92d81b26 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -8,8 +8,7 @@
8#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 8#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
9 9
10/* used by in-kernel data structures */ 10/* used by in-kernel data structures */
11struct kern_ipc_perm 11struct kern_ipc_perm {
12{
13 spinlock_t lock; 12 spinlock_t lock;
14 bool deleted; 13 bool deleted;
15 int id; 14 int id;
@@ -18,9 +17,9 @@ struct kern_ipc_perm
18 kgid_t gid; 17 kgid_t gid;
19 kuid_t cuid; 18 kuid_t cuid;
20 kgid_t cgid; 19 kgid_t cgid;
21 umode_t mode; 20 umode_t mode;
22 unsigned long seq; 21 unsigned long seq;
23 void *security; 22 void *security;
24}; 23} ____cacheline_aligned_in_smp;
25 24
26#endif /* _LINUX_IPC_H */ 25#endif /* _LINUX_IPC_H */