diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-01-16 14:54:50 +0100 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-17 21:54:21 -0500 |
commit | 4ded95ddc4a08a5b90f42307a51624268a0e710e (patch) | |
tree | 890a98089ab7d17612bdc8f0768a3738e28c7839 /kernel | |
parent | a4698e92ee80d2a5bf18cb6ceedb002d9b107069 (diff) |
futexes: Fix futex_hashsize initialization
"futexes: Increase hash table size for better performance"
introduces a new alloc_large_system_hash() call.
alloc_large_system_hash() however may allocate less memory than
requested, e.g. limited by MAX_ORDER.
Hence pass a pointer to alloc_large_system_hash() which will
contain the hash shift when the function returns. Afterwards
correctly set futex_hashsize.
Fixes a crash on s390 where the requested allocation size was
4MB but only 1MB was allocated.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Darren Hart <dvhart@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Waiman Long <Waiman.Long@hp.com>
Cc: Jason Low <jason.low2@hp.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Link: http://lkml.kernel.org/r/20140116135450.GA4345@osiris
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/futex.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 54c5bf46abac..bdc420d30a03 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2844,6 +2844,7 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, static int __init futex_init(void) { u32 curval; + unsigned int futex_shift; unsigned long i; #if CONFIG_BASE_SMALL @@ -2855,8 +2856,9 @@ static int __init futex_init(void) futex_queues = alloc_large_system_hash("futex", sizeof(*futex_queues), futex_hashsize, 0, futex_hashsize < 256 ? HASH_SMALL : 0, - NULL, NULL, futex_hashsize, futex_hashsize); - + &futex_shift, NULL, + futex_hashsize, futex_hashsize); + futex_hashsize = 1UL << futex_shift; /* * This will fail and we want it. Some arch implementations do * runtime detection of the futex_atomic_cmpxchg_inatomic() |