]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
a51de1a48548b53153748d6a3c9501efe7176bd1
[thirdparty/kernel/stable-queue.git] /
1 From 92cc5d00a431e96e5a49c0b97e5ad4fa7536bd4b Mon Sep 17 00:00:00 2001
2 From: John Stultz <jstultz@google.com>
3 Date: Wed, 3 May 2023 02:33:51 +0000
4 Subject: locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers
5
6 From: John Stultz <jstultz@google.com>
7
8 commit 92cc5d00a431e96e5a49c0b97e5ad4fa7536bd4b upstream.
9
10 Apparently despite it being marked inline, the compiler
11 may not inline __down_read_common() which makes it difficult
12 to identify the cause of lock contention, as the blocked
13 function in traceevents will always be listed as
14 __down_read_common().
15
16 So this patch adds __always_inline annotation to the common
17 function (as well as the inlined helper callers) to force it to
18 be inlined so the blocking function will be listed (via Wchan)
19 in traceevents.
20
21 Fixes: c995e638ccbb ("locking/rwsem: Fold __down_{read,write}*()")
22 Reported-by: Tim Murray <timmurray@google.com>
23 Signed-off-by: John Stultz <jstultz@google.com>
24 Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
25 Reviewed-by: Waiman Long <longman@redhat.com>
26 Cc: stable@vger.kernel.org
27 Link: https://lkml.kernel.org/r/20230503023351.2832796-1-jstultz@google.com
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 ---
30 kernel/locking/rwsem.c | 8 ++++----
31 1 file changed, 4 insertions(+), 4 deletions(-)
32
33 --- a/kernel/locking/rwsem.c
34 +++ b/kernel/locking/rwsem.c
35 @@ -1251,7 +1251,7 @@ static struct rw_semaphore *rwsem_downgr
36 /*
37 * lock for reading
38 */
39 -static inline int __down_read_common(struct rw_semaphore *sem, int state)
40 +static __always_inline int __down_read_common(struct rw_semaphore *sem, int state)
41 {
42 int ret = 0;
43 long count;
44 @@ -1269,17 +1269,17 @@ out:
45 return ret;
46 }
47
48 -static inline void __down_read(struct rw_semaphore *sem)
49 +static __always_inline void __down_read(struct rw_semaphore *sem)
50 {
51 __down_read_common(sem, TASK_UNINTERRUPTIBLE);
52 }
53
54 -static inline int __down_read_interruptible(struct rw_semaphore *sem)
55 +static __always_inline int __down_read_interruptible(struct rw_semaphore *sem)
56 {
57 return __down_read_common(sem, TASK_INTERRUPTIBLE);
58 }
59
60 -static inline int __down_read_killable(struct rw_semaphore *sem)
61 +static __always_inline int __down_read_killable(struct rw_semaphore *sem)
62 {
63 return __down_read_common(sem, TASK_KILLABLE);
64 }