Skip to content

Commit 6cef7ff

Browse files
Waiman-LongIngo Molnar
authored andcommitted
locking/rwsem: Code cleanup after files merging
After merging all the relevant rwsem code into one single file, there are a number of optimizations and cleanups that can be done: 1) Remove all the EXPORT_SYMBOL() calls for functions that are not accessed elsewhere. 2) Remove all the __visible tags as none of the functions will be called from assembly code anymore. 3) Make all the internal functions static. 4) Remove some unneeded blank lines. 5) Remove the intermediate rwsem_down_{read|write}_failed*() functions and rename __rwsem_down_{read|write}_failed_common() to rwsem_down_{read|write}_slowpath(). 6) Remove "__" prefix of __rwsem_mark_wake(). 7) Use atomic_long_try_cmpxchg_acquire() as much as possible. 8) Remove the rwsem_rtrylock and rwsem_wtrylock lock events as they are not that useful. That enables the compiler to do better optimization and reduce code size. The text+data size of rwsem.o on an x86-64 machine with gcc8 was reduced from 10237 bytes to 5030 bytes with this change. Suggested-by: Peter Zijlstra <[email protected]> Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tim Chen <[email protected]> Cc: Will Deacon <[email protected]> Cc: huang ying <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 5dec94d commit 6cef7ff

File tree

2 files changed

+42
-95
lines changed

2 files changed

+42
-95
lines changed

kernel/locking/lock_events_list.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,5 @@ LOCK_EVENT(rwsem_opt_fail) /* # of failed opt-spinnings */
6161
LOCK_EVENT(rwsem_rlock) /* # of read locks acquired */
6262
LOCK_EVENT(rwsem_rlock_fast) /* # of fast read locks acquired */
6363
LOCK_EVENT(rwsem_rlock_fail) /* # of failed read lock acquisitions */
64-
LOCK_EVENT(rwsem_rtrylock) /* # of read trylock calls */
6564
LOCK_EVENT(rwsem_wlock) /* # of write locks acquired */
6665
LOCK_EVENT(rwsem_wlock_fail) /* # of failed write lock acquisitions */
67-
LOCK_EVENT(rwsem_wtrylock) /* # of write trylock calls */

0 commit comments

Comments
 (0)