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

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
12401240 /*
12411241 * lock for reading
12421242 */
1243−static inline int __down_read_common(struct rw_semaphore *sem, int state)
1243+static __always_inline int __down_read_common(struct rw_semaphore *sem, int state)
12441244 {
12451245 int ret = 0;
12461246 long count;
@@ -1258,17 +1258,17 @@ out: · 11 unmodified lines
12581258 return ret;
12591259 }
12601260
1261−static inline void __down_read(struct rw_semaphore *sem)
1261+static __always_inline void __down_read(struct rw_semaphore *sem)
12621262 {
12631263 __down_read_common(sem, TASK_UNINTERRUPTIBLE);
12641264 }
12651265
1266−static inline int __down_read_interruptible(struct rw_semaphore *sem)
1266+static __always_inline int __down_read_interruptible(struct rw_semaphore *sem)
12671267 {
12681268 return __down_read_common(sem, TASK_INTERRUPTIBLE);
12691269 }
12701270
1271−static inline int __down_read_killable(struct rw_semaphore *sem)
1271+static __always_inline int __down_read_killable(struct rw_semaphore *sem)
12721272 {
12731273 return __down_read_common(sem, TASK_KILLABLE);
12741274 }