* [PATCH] sched: Assert for_each_thread() is properly locked
@ 2023-08-21 13:44 Matthew Wilcox (Oracle)
2023-08-21 17:55 ` Joel Fernandes
2023-09-15 8:36 ` [tip: sched/core] " tip-bot2 for Matthew Wilcox (Oracle)
0 siblings, 2 replies; 3+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-08-21 13:44 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra
Cc: Matthew Wilcox (Oracle), linux-kernel, Tong Tiangen, rcu
list_for_each_entry_rcu() takes an optional fourth argument which
allows RCU to assert that the correct lock is held. Several callers
of for_each_thread() rely on their caller to be holding the appropriate
lock, so this is a useful assertion to include.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/sched/signal.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 669e8cff40c7..f1eae7f53be9 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -659,7 +659,8 @@ extern bool current_is_single_threaded(void);
while ((t = next_thread(t)) != g)
#define __for_each_thread(signal, t) \
- list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
+ list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node, \
+ lockdep_is_held(&tasklist_lock))
#define for_each_thread(p, t) \
__for_each_thread((p)->signal, t)
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: Assert for_each_thread() is properly locked
2023-08-21 13:44 [PATCH] sched: Assert for_each_thread() is properly locked Matthew Wilcox (Oracle)
@ 2023-08-21 17:55 ` Joel Fernandes
2023-09-15 8:36 ` [tip: sched/core] " tip-bot2 for Matthew Wilcox (Oracle)
1 sibling, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2023-08-21 17:55 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, Tong Tiangen, rcu
On Mon, Aug 21, 2023 at 02:44:28PM +0100, Matthew Wilcox (Oracle) wrote:
> list_for_each_entry_rcu() takes an optional fourth argument which
> allows RCU to assert that the correct lock is held. Several callers
> of for_each_thread() rely on their caller to be holding the appropriate
> lock, so this is a useful assertion to include.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
thanks,
- Joel
> ---
> include/linux/sched/signal.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
> index 669e8cff40c7..f1eae7f53be9 100644
> --- a/include/linux/sched/signal.h
> +++ b/include/linux/sched/signal.h
> @@ -659,7 +659,8 @@ extern bool current_is_single_threaded(void);
> while ((t = next_thread(t)) != g)
>
> #define __for_each_thread(signal, t) \
> - list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
> + list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node, \
> + lockdep_is_held(&tasklist_lock))
>
> #define for_each_thread(p, t) \
> __for_each_thread((p)->signal, t)
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: sched/core] sched: Assert for_each_thread() is properly locked
2023-08-21 13:44 [PATCH] sched: Assert for_each_thread() is properly locked Matthew Wilcox (Oracle)
2023-08-21 17:55 ` Joel Fernandes
@ 2023-09-15 8:36 ` tip-bot2 for Matthew Wilcox (Oracle)
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Matthew Wilcox (Oracle) @ 2023-09-15 8:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: Matthew Wilcox (Oracle), Ingo Molnar, Joel Fernandes (Google),
x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 4de7b17fd05d03fa919e8c47fc66122bd24d7b6c
Gitweb: https://git.kernel.org/tip/4de7b17fd05d03fa919e8c47fc66122bd24d7b6c
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
AuthorDate: Mon, 21 Aug 2023 14:44:28 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 15 Sep 2023 10:33:29 +02:00
sched: Assert for_each_thread() is properly locked
list_for_each_entry_rcu() takes an optional fourth argument which
allows RCU to assert that the correct lock is held. Several callers
of for_each_thread() rely on their caller to be holding the appropriate
lock, so this is a useful assertion to include.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Link: https://lore.kernel.org/r/20230821134428.2504912-1-willy@infradead.org
---
include/linux/sched/signal.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 0014d3a..9610bad 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -656,7 +656,8 @@ extern bool current_is_single_threaded(void);
while ((t = next_thread(t)) != g)
#define __for_each_thread(signal, t) \
- list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
+ list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node, \
+ lockdep_is_held(&tasklist_lock))
#define for_each_thread(p, t) \
__for_each_thread((p)->signal, t)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-15 8:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21 13:44 [PATCH] sched: Assert for_each_thread() is properly locked Matthew Wilcox (Oracle)
2023-08-21 17:55 ` Joel Fernandes
2023-09-15 8:36 ` [tip: sched/core] " tip-bot2 for Matthew Wilcox (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox