Skip to content

Commit d179ebe

Browse files
johnstultz-workgregkh
authored andcommitted
locking/rwsem: Add __always_inline annotation to __down_write_common() and inlined callers
[ Upstream commit e81859f ] Apparently despite it being marked inline, the compiler may not inline __down_write_common() which makes it difficult to identify the cause of lock contention, as the wchan of the blocked function will always be listed as __down_write_common(). So add __always_inline annotation to the common function (as well as the inlined helper callers) to force it to be inlined so a more useful blocking function will be listed (via wchan). This mirrors commit 92cc5d0 ("locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers") which did the same for __down_read_common. I sort of worry that I'm playing wack-a-mole here, and talking with compiler people, they tell me inline means nothing, which makes me want to cry a little. So I'm wondering if we need to replace all the inlines with __always_inline, or remove them because either we mean something by it, or not. Fixes: c995e63 ("locking/rwsem: Fold __down_{read,write}*()") Reported-by: Tim Murray <[email protected]> Signed-off-by: John Stultz <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Waiman Long <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 9a95e70 commit d179ebe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/locking/rwsem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
12971297
/*
12981298
* lock for writing
12991299
*/
1300-
static inline int __down_write_common(struct rw_semaphore *sem, int state)
1300+
static __always_inline int __down_write_common(struct rw_semaphore *sem, int state)
13011301
{
13021302
int ret = 0;
13031303

@@ -1310,12 +1310,12 @@ static inline int __down_write_common(struct rw_semaphore *sem, int state)
13101310
return ret;
13111311
}
13121312

1313-
static inline void __down_write(struct rw_semaphore *sem)
1313+
static __always_inline void __down_write(struct rw_semaphore *sem)
13141314
{
13151315
__down_write_common(sem, TASK_UNINTERRUPTIBLE);
13161316
}
13171317

1318-
static inline int __down_write_killable(struct rw_semaphore *sem)
1318+
static __always_inline int __down_write_killable(struct rw_semaphore *sem)
13191319
{
13201320
return __down_write_common(sem, TASK_KILLABLE);
13211321
}

0 commit comments

Comments
 (0)