CVE-2018-5703 : Skipped due to fix rejected upstream
futex: Remove requirement for lock_page() in get_futex_key()
commit 65d8fc777f6dcfee12785c057a6b57f679641c90 upstream.
When dealing with key handling for shared futexes, we can drastically reduce
the usage/need of the page lock. 1) For anonymous pages, the associated futex
object is the mm_struct which does not require the page lock. 2) For inode
based, keys, we can check under RCU read lock if the page mapping is still
valid and take reference to the inode. This just leaves one rare race that
requires the page lock in the slow path when examining the swapcache.
Additionally realtime users currently have a problem with the page lock being
contended for unbounded periods of time during futex operations.
Now any other task trying to lock that page will have to wait until
task A gets scheduled back in, which is an unbound time.
With this patch, we pretty much have a lockless futex_get_key().
Experiments show that this patch can boost/speedup the hashing of shared
futexes with the perf futex benchmarks (which is good for measuring such
change) by up to 45% when there are high (> 100) thread counts on a 60 core
Westmere. Lower counts are pretty much in the noise range or less than 10%,
but mid range can be seen at over 30% overall throughput (hash ops/sec).
This makes anon-mem shared futexes much closer to its private counterpart.
Signed-off-by: Mel Gorman <firstname.lastname@example.org>
[ Ported on top of thp refcount rework, changelog, comments, fixes. ]
Signed-off-by: Davidlohr Bueso <email@example.com>
Reviewed-by: Thomas Gleixner <firstname.lastname@example.org>
Cc: Chris Mason <email@example.com>
Cc: Darren Hart <firstname.lastname@example.org>
Cc: Hugh Dickins <email@example.com>
Cc: Linus Torvalds <firstname.lastname@example.org>
Cc: Mel Gorman <email@example.com>
Cc: Peter Zijlstra <firstname.lastname@example.org>
Cc: Sebastian Andrzej Siewior <email@example.com>
Signed-off-by: Ingo Molnar <firstname.lastname@example.org>
Signed-off-by: Chenbo Feng <email@example.com>
Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
1 file changed