Skip to contentSkip to conversation

sched: Update comment of try_invoke_on_locked_down_task()

PATCH Applied Zhang Qiao 4 participants 6 messages Jul 31, 2023 – Oct 7, 2023 Scheduler

lore
Share & tools
lore

Zhang Qiao

author
#0 lore raw

PATCH 1/1 sched: Update comment of try_invoke_on_locked_down_task()

Since commit 9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()") renamed try_invoke_on_locked_down_task() to task_call_func(). Now, update some comment about it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 0d18c3969f90..540ac33ddb80 100644
@@ -4186,7 +4186,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 	 * __schedule().  See the comment for smp_mb__after_spinlock().
 	 *
-	 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+	 * A similar smb_rmb() lives in task_call_func().
 	 */
 	smp_rmb();
 	if (READ_ONCE(p->on_rq) && ttwu_runnable(p, wake_flags))
Signature · 1 line
2.25.1
#1 lore raw
Quoted 15 lines · Zhang Qiao

Since commit 9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()") renamed try_invoke_on_locked_down_task() to task_call_func(). Now, update some comment about it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +0 -0
index 0d18c3969f90..540ac33ddb80 100644

kernel/sched/core.c try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) · line 4189

Quoted 5 lines
kernel/sched/core.c +1 -1
@@ -4186,7 +4186,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 	 * __schedule().  See the comment for smp_mb__after_spinlock().
 	 *
-	 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+	 * A similar smb_rmb() lives in task_call_func().

Except the matching smp_rmb() doesn't live in task_call_func() anymore, so you now turned a stale comment into a misleading one ...

And how about fixing the obvious 'smb/smp' typo as well?

Thanks,

Ingo

maintainer
#2 lore raw
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Zhang Qiao

Since commit 9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()") renamed try_invoke_on_locked_down_task() to task_call_func(). Now, update some comment about it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

kernel/sched/core.c try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) · line 4189

Quoted 10 lines
kernel/sched/core.c +1 -1
index 0d18c3969f90..540ac33ddb80 100644
@@ -4186,7 +4186,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 	 * __schedule().  See the comment for smp_mb__after_spinlock().
 	 *
-	 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+	 * A similar smb_rmb() lives in task_call_func().

Except the matching smp_rmb() doesn't live in task_call_func() anymore, so you now turned a stale comment into a misleading one ...

It moved, *again*, it's now in __task_needs_rq_lock() :-)

#3 lore raw

PATCH 1/1 sched/core: Update stale comment in try_to_wake_up()

Quoted 28 lines · Peter Zijlstra
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Zhang Qiao

Since commit 9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()") renamed try_invoke_on_locked_down_task() to task_call_func(). Now, update some comment about it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

kernel/sched/core.c try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) · line 4189

Quoted 10 lines
kernel/sched/core.c +1 -1
index 0d18c3969f90..540ac33ddb80 100644
@@ -4186,7 +4186,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 	 * __schedule().  See the comment for smp_mb__after_spinlock().
 	 *
-	 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+	 * A similar smb_rmb() lives in task_call_func().

Except the matching smp_rmb() doesn't live in task_call_func() anymore, so you now turned a stale comment into a misleading one ...

Quoted 1 line

It moved, *again*, it's now in __task_needs_rq_lock() :-)

Yeah, I know, see:

bdf85bec2b1e ("sched/core: Update stale comment in try_to_wake_up()")

Thanks,

Ingo

====================>
From: Ingo Molnar <[email protected]>
Date: Wed, 4 Oct 2023 11:33:36 +0200
Subject: [PATCH] sched/core: Update stale comment in try_to_wake_up()

The following commit:

9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()")

... renamed try_invoke_on_locked_down_task() to task_call_func(), but forgot to update the comment in try_to_wake_up().

But it turns out that the smp_rmb() doesn't live in task_call_func() either, it was moved to __task_needs_rq_lock() in:

91dabf33ae5d ("sched: Fix race in task_call_func()")

Fix that now.

Also fix the s/smb/smp typo while at it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 65e10ac34660..f5783cb16791 100644
@@ -4237,7 +4237,7 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 		 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 		 * __schedule().  See the comment for smp_mb__after_spinlock().
 		 *
-		 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+		 * A similar smp_rmb() lives in __task_needs_rq_lock().
 		 */
 		smp_rmb();
 		if (READ_ONCE(p->on_rq) && ttwu_runnable(p, wake_flags))
merge bot Applied
#4 lore raw

[tip: sched/core] sched/core: Update stale comment in try_to_wake_up()

In reply to Zhang Qiao
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     bdf85bec2b1ea852daf415cf6f1c9ef7d584c8c5
Gitweb:        https://git.kernel.org/tip/bdf85bec2b1ea852daf415cf6f1c9ef7d584c8c5
Author:        Ingo Molnar <[email protected]>
AuthorDate:    Wed, 04 Oct 2023 11:33:36 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Wed, 04 Oct 2023 11:34:34 +02:00

sched/core: Update stale comment in try_to_wake_up()

The following commit:

9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()")

... renamed try_invoke_on_locked_down_task() to task_call_func(), but forgot to update the comment in try_to_wake_up().

But it turns out that the smp_rmb() doesn't live in task_call_func() either, it was moved to __task_needs_rq_lock() in:

91dabf33ae5d ("sched: Fix race in task_call_func()")

Fix that now.

Also fix the s/smb/smp typo while at it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 65e10ac..f5783cb 100644
@@ -4237,7 +4237,7 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 		 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 		 * __schedule().  See the comment for smp_mb__after_spinlock().
 		 *
-		 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+		 * A similar smp_rmb() lives in __task_needs_rq_lock().
 		 */
 		smp_rmb();
 		if (READ_ONCE(p->on_rq) && ttwu_runnable(p, wake_flags))
merge bot Applied
#5 lore raw

[tip: sched/core] sched/core: Update stale comment in try_to_wake_up()

In reply to Zhang Qiao
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     ea41bb514fe286bf50498b3c6d7f7a5dc2b6c5e0
Gitweb:        https://git.kernel.org/tip/ea41bb514fe286bf50498b3c6d7f7a5dc2b6c5e0
Author:        Ingo Molnar <[email protected]>
AuthorDate:    Wed, 04 Oct 2023 11:33:36 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sat, 07 Oct 2023 11:33:28 +02:00

sched/core: Update stale comment in try_to_wake_up()

The following commit:

9b3c4ab3045e ("sched,rcu: Rework try_invoke_on_locked_down_task()")

... renamed try_invoke_on_locked_down_task() to task_call_func(), but forgot to update the comment in try_to_wake_up().

But it turns out that the smp_rmb() doesn't live in task_call_func() either, it was moved to __task_needs_rq_lock() in:

91dabf33ae5d ("sched: Fix race in task_call_func()")

Fix that now.

Also fix the s/smb/smp typo while at it.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 65e10ac..f5783cb 100644
@@ -4237,7 +4237,7 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 		 * Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
 		 * __schedule().  See the comment for smp_mb__after_spinlock().
 		 *
-		 * A similar smb_rmb() lives in try_invoke_on_locked_down_task().
+		 * A similar smp_rmb() lives in __task_needs_rq_lock().
 		 */
 		smp_rmb();
 		if (READ_ONCE(p->on_rq) && ttwu_runnable(p, wake_flags))