History

locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers

Apparently despite it being marked inline, the compiler may not inline __down_read_common() which makes it difficult to identify the cause of lock contention, as the blocked function in traceevents will always be listed as __down_read_common(). So this patch adds __always_inline annotation to the common function (as well as the inlined helper callers) to force it to be inlined so the blocking function will be listed (via Wchan) in traceevents.

John Stultz committed 3 years ago

Commit 92cc5d01 parent ac9a7861 file · +4 −4Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/locking/rwsem.c+4−4
@@ -1240,7 +1240,7 @@ static struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) · 1239 unmodified lines
1240/*1240/*
1241 * lock for reading1241 * lock for reading
1242 */1242 */
1243static inline int __down_read_common(struct rw_semaphore *sem, int state)1243static __always_inline int __down_read_common(struct rw_semaphore *sem, int state)
1244{1244{
1245 int ret = 0;1245 int ret = 0;
1246 long count;1246 long count;
@@ -1258,17 +1258,17 @@ out: · 11 unmodified lines
1258 return ret;1258 return ret;
1259}1259}
1260 1260
1261static inline void __down_read(struct rw_semaphore *sem)1261static __always_inline void __down_read(struct rw_semaphore *sem)
1262{1262{
1263 __down_read_common(sem, TASK_UNINTERRUPTIBLE);1263 __down_read_common(sem, TASK_UNINTERRUPTIBLE);
1264}1264}
1265 1265
1266static inline int __down_read_interruptible(struct rw_semaphore *sem)1266static __always_inline int __down_read_interruptible(struct rw_semaphore *sem)
1267{1267{
1268 return __down_read_common(sem, TASK_INTERRUPTIBLE);1268 return __down_read_common(sem, TASK_INTERRUPTIBLE);
1269}1269}
1270 1270
1271static inline int __down_read_killable(struct rw_semaphore *sem)1271static __always_inline int __down_read_killable(struct rw_semaphore *sem)
1272{1272{
1273 return __down_read_common(sem, TASK_KILLABLE);1273 return __down_read_common(sem, TASK_KILLABLE);
1274}1274}