sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
PATCH 1/1 sched/core: Remove double update_rq_clock() in __set_cpus_allowed_ptr_locked()
From: Hao Jia <[email protected]>
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.
--- kernel/sched/core.c | 2 -- 1 file changed, 2 deletions(-)
kernel/sched/core.c +0 -2
@@ -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,
Signature · 1 line
2.34.1
Hello Hao,
Quoted 9 lines · Hao Jia
From: Hao Jia <[email protected]>
Since commit
d4c64207b88a("sched: Cleanup thesched_changeNOCLOCK usage"),update_rq_clock()is called indo_set_cpus_allowed()->sched_change_begin()to update the rq clock. This results in a duplicate callupdate_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 updatedrq_clock.
I couldn't spot any dependency on rq_clock() until do_set_cpus_allowed() either so please feel free to include:
Signature · 2 lines
Thanks and Regards, Prateek
Quoted 24 lines
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 <[email protected]>--- kernel/sched/core.c | 2 -- 1 file changed, 2 deletions(-)kernel/sched/core.c +0
-2@@ -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,
Peter Zijlstra
maintainerQuoted 10 lines · K Prateek Nayak
Hello Hao,
Quoted 7 lines · Hao Jia
From: Hao Jia <[email protected]>
Since commit
d4c64207b88a("sched: Cleanup thesched_changeNOCLOCK usage"),update_rq_clock()is called indo_set_cpus_allowed()->sched_change_begin()to update the rq clock. This results in a duplicate callupdate_rq_clock()in__set_cpus_allowed_ptr_locked().
Quoted 7 lines
Quoted 2 lines
While holding the rq lock and before calling
do_set_cpus_allowed(), there is nothing that depends on an updatedrq_clock.I couldn't spot any dependency on
rq_clock()untildo_set_cpus_allowed()either so please feel free to include:Reviewed-by K Prateek Nayak <[email protected]>
Indeed, thanks!
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: e40cea333e60c548e047eaddec6ca48c6632424b Gitweb: https://git.kernel.org/tip/e40cea333e60c548e047eaddec6ca48c6632424b Author: Hao Jia <[email protected]> AuthorDate: Wed, 29 Oct 2025 17:36:55 +08:00 Committer: Peter Zijlstra <[email protected]> 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.
--- kernel/sched/core.c | 2 -- 1 file changed, 2 deletions(-)
kernel/sched/core.c +0 -2
@@ -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,