* [PATCH] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
@ 2025-10-29 9:36 Hao Jia
2025-10-30 4:04 ` K Prateek Nayak
2025-11-11 11:37 ` [tip: sched/core] " tip-bot2 for Hao Jia
0 siblings, 2 replies; 4+ messages in thread
From: Hao Jia @ 2025-10-29 9:36 UTC (permalink / raw)
To: mingo, peterz, mingo, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
kprateek.nayak
Cc: linux-kernel, Hao Jia
From: Hao Jia <jiahao1@lixiang.com>
Since commit d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage"),
update_rq_clock() is called in do_set_cpus_allowed() -> sched_change_begin()
to update the rq clock. This results in a duplicate call update_rq_clock()
in __set_cpus_allowed_ptr_locked().
While holding the rq lock and before calling do_set_cpus_allowed(),
there is nothing that depends on an updated rq_clock.
Therefore, remove the redundant update_rq_clock() in
__set_cpus_allowed_ptr_locked() to avoid the warning about double
rq clock updates.
Fixes: d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage")
Signed-off-by: Hao Jia <jiahao1@lixiang.com>
---
kernel/sched/core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1842285eac1e..1123cd0ddffb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2999,8 +2999,6 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
unsigned int dest_cpu;
int ret = 0;
- update_rq_clock(rq);
-
if (kthread || is_migration_disabled(p)) {
/*
* Kernel threads are allowed on online && !active CPUs,
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
2025-10-29 9:36 [PATCH] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked() Hao Jia
@ 2025-10-30 4:04 ` K Prateek Nayak
2025-10-30 9:14 ` Peter Zijlstra
2025-11-11 11:37 ` [tip: sched/core] " tip-bot2 for Hao Jia
1 sibling, 1 reply; 4+ messages in thread
From: K Prateek Nayak @ 2025-10-30 4:04 UTC (permalink / raw)
To: Hao Jia, mingo, peterz, mingo, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid
Cc: linux-kernel, Hao Jia
Hello Hao,
On 10/29/2025 3:06 PM, Hao Jia wrote:
> From: Hao Jia <jiahao1@lixiang.com>
>
> Since commit d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage"),
> update_rq_clock() is called in do_set_cpus_allowed() -> sched_change_begin()
> to update the rq clock. This results in a duplicate call update_rq_clock()
> in __set_cpus_allowed_ptr_locked().
>
> While holding the rq lock and before calling do_set_cpus_allowed(),
> there is nothing that depends on an updated rq_clock.
I couldn't spot any dependency on rq_clock() until do_set_cpus_allowed()
either so please feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
--
Thanks and Regards,
Prateek
>
> Therefore, remove the redundant update_rq_clock() in
> __set_cpus_allowed_ptr_locked() to avoid the warning about double
> rq clock updates.
>
> Fixes: d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage")
> Signed-off-by: Hao Jia <jiahao1@lixiang.com>
> ---
> kernel/sched/core.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 1842285eac1e..1123cd0ddffb 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2999,8 +2999,6 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
> unsigned int dest_cpu;
> int ret = 0;
>
> - update_rq_clock(rq);
> -
> if (kthread || is_migration_disabled(p)) {
> /*
> * Kernel threads are allowed on online && !active CPUs,
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
2025-10-30 4:04 ` K Prateek Nayak
@ 2025-10-30 9:14 ` Peter Zijlstra
0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2025-10-30 9:14 UTC (permalink / raw)
To: K Prateek Nayak
Cc: Hao Jia, mingo, mingo, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
linux-kernel, Hao Jia
On Thu, Oct 30, 2025 at 09:34:00AM +0530, K Prateek Nayak wrote:
> Hello Hao,
>
> On 10/29/2025 3:06 PM, Hao Jia wrote:
> > From: Hao Jia <jiahao1@lixiang.com>
> >
> > Since commit d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage"),
> > update_rq_clock() is called in do_set_cpus_allowed() -> sched_change_begin()
> > to update the rq clock. This results in a duplicate call update_rq_clock()
> > in __set_cpus_allowed_ptr_locked().
> >
> > While holding the rq lock and before calling do_set_cpus_allowed(),
> > there is nothing that depends on an updated rq_clock.
>
> I couldn't spot any dependency on rq_clock() until do_set_cpus_allowed()
> either so please feel free to include:
>
> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Indeed, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: sched/core] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
2025-10-29 9:36 [PATCH] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked() Hao Jia
2025-10-30 4:04 ` K Prateek Nayak
@ 2025-11-11 11:37 ` tip-bot2 for Hao Jia
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Hao Jia @ 2025-11-11 11:37 UTC (permalink / raw)
To: linux-tip-commits
Cc: Hao Jia, Peter Zijlstra (Intel), K Prateek Nayak, x86,
linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: e40cea333e60c548e047eaddec6ca48c6632424b
Gitweb: https://git.kernel.org/tip/e40cea333e60c548e047eaddec6ca48c6632424b
Author: Hao Jia <jiahao1@lixiang.com>
AuthorDate: Wed, 29 Oct 2025 17:36:55 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 11 Nov 2025 12:33:38 +01:00
sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
Since commit d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage"),
update_rq_clock() is called in do_set_cpus_allowed() -> sched_change_begin()
to update the rq clock. This results in a duplicate call update_rq_clock()
in __set_cpus_allowed_ptr_locked().
While holding the rq lock and before calling do_set_cpus_allowed(),
there is nothing that depends on an updated rq_clock.
Therefore, remove the redundant update_rq_clock() in
__set_cpus_allowed_ptr_locked() to avoid the warning about double
rq clock updates.
Fixes: d4c64207b88a ("sched: Cleanup the sched_change NOCLOCK usage")
Signed-off-by: Hao Jia <jiahao1@lixiang.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://patch.msgid.link/20251029093655.31252-1-jiahao.kernel@gmail.com
---
kernel/sched/core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 67b5f2f..68f19aa 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2999,8 +2999,6 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
unsigned int dest_cpu;
int ret = 0;
- update_rq_clock(rq);
-
if (kthread || is_migration_disabled(p)) {
/*
* Kernel threads are allowed on online && !active CPUs,
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-11 11:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29 9:36 [PATCH] sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked() Hao Jia
2025-10-30 4:04 ` K Prateek Nayak
2025-10-30 9:14 ` Peter Zijlstra
2025-11-11 11:37 ` [tip: sched/core] " tip-bot2 for Hao Jia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox