Skip to content

Commit

Permalink
ipc/sem.c: cacheline align the ipc spinlock for semaphores
Browse files Browse the repository at this point in the history
Cacheline align 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>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
manfred-colorfu authored and torvalds committed May 27, 2010
1 parent 0a2b9d4 commit 31a7c47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/linux/sem.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct seminfo {
#ifdef __KERNEL__
#include <asm/atomic.h>
#include <linux/rcupdate.h>
#include <linux/cache.h>

struct task_struct;

Expand All @@ -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 */
Expand Down

0 comments on commit 31a7c47

Please sign in to comment.