mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] Cleanup: preempt notifiers: disallow hlist_del within unsafe iteration
@ 2015-05-17 16:53 Mathieu Desnoyers
  2015-06-19 18:00 ` [tip:sched/core] sched/preempt: Fix preempt notifiers documentation about hlist_del() " tip-bot for Mathieu Desnoyers
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers @ 2015-05-17 16:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Mathieu Desnoyers, Peter Zijlstra, Avi Kivity

preempt_notifier_unregister() documents:

  "This is safe to call from within a preemption notifier."

However, both fire_sched_in_preempt_notifiers() and
fire_sched_out_preempt_notifiers() are using hlist_for_each_entry(),
which is not safe against entry removal during iteration.

Inspection of the kvm code does not reveal any use of
preempt_notifier_unregister() within the preempt notifiers.

Therefore, fix the bogus comment.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Avi Kivity <avi@qumranet.com>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 57bd333..9edefec 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2119,7 +2119,7 @@ EXPORT_SYMBOL_GPL(preempt_notifier_register);
  * preempt_notifier_unregister - no longer interested in preemption notifications
  * @notifier: notifier struct to unregister
  *
- * This is safe to call from within a preemption notifier.
+ * This is *not* safe to call from within a preemption notifier.
  */
 void preempt_notifier_unregister(struct preempt_notifier *notifier)
 {
-- 
2.1.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-19 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-17 16:53 [RFC PATCH] Cleanup: preempt notifiers: disallow hlist_del within unsafe iteration Mathieu Desnoyers
2015-06-19 18:00 ` [tip:sched/core] sched/preempt: Fix preempt notifiers documentation about hlist_del() " tip-bot for Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome