From: Eric Dumazet The file_lock spinlock sits close to mostly read fields of 'struct files_struct' In SMP (and NUMA) environnements, each time a thread wants to open or close a file, it has to acquire the spinlock, thus invalidating the cache line containing this spinlock on other CPUS. So other threads doing read()/write()/... calls that use RCU to access the file table are going to ask further memory (possibly NUMA) transactions to read again this memory line. Move the spinlock to another cache line, so that concurrent threads can share the cache line containing 'count' and 'fdt' fields. Signed-off-by: Eric Dumazet Signed-off-by: Andrew Morton --- include/linux/file.h | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff -puN include/linux/file.h~reorder-struct-files_struct include/linux/file.h --- 25/include/linux/file.h~reorder-struct-files_struct Wed Sep 14 14:22:52 2005 +++ 25-akpm/include/linux/file.h Wed Sep 14 14:23:29 2005 @@ -33,13 +33,13 @@ struct fdtable { * Open file table structure */ struct files_struct { - atomic_t count; - spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ + atomic_t count; struct fdtable *fdt; struct fdtable fdtab; - fd_set close_on_exec_init; - fd_set open_fds_init; - struct file * fd_array[NR_OPEN_DEFAULT]; + fd_set close_on_exec_init; + fd_set open_fds_init; + struct file * fd_array[NR_OPEN_DEFAULT]; + spinlock_t file_lock; /* Protects concurrent writers. Nests inside tsk->alloc_lock */ }; #define files_fdtable(files) (rcu_dereference((files)->fdt)) _