sched: Update comment of try_invoke_on_locked_down_task()

Message ID 20230731085759.11443-1-zhangqiao22@huawei.com
State New
Headers
Series sched: Update comment of try_invoke_on_locked_down_task() |

Commit Message

Zhang Qiao July 31, 2023, 8:57 a.m. UTC
  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.

Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ingo Molnar Oct. 4, 2023, 9:31 a.m. UTC | #1
* Zhang Qiao <zhangqiao22@huawei.com> wrote:

> 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.
> 
> Signed-off-by: Zhang Qiao <zhangqiao22@huawei.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 0d18c3969f90..540ac33ddb80 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -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
  
Peter Zijlstra Oct. 4, 2023, 9:33 a.m. UTC | #2
On Wed, Oct 04, 2023 at 11:31:26AM +0200, Ingo Molnar wrote:
> 
> * Zhang Qiao <zhangqiao22@huawei.com> wrote:
> 
> > 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.
> > 
> > Signed-off-by: Zhang Qiao <zhangqiao22@huawei.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 0d18c3969f90..540ac33ddb80 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -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() :-)
  

Patch

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0d18c3969f90..540ac33ddb80 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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))