tick/nohz: remove function tick_nohz_full_add_cpus_to
Subsystems (3)
PATCH 1/4 tick/nohz: remove function tick_nohz_full_add_cpus_to
From: Alex Shi <[email protected]>
This function isn't used by anyone. Remove it.
--- include/linux/tick.h | 7 ------- 1 file changed, 7 deletions(-)
include/linux/tick.h +0 -7
@@ -195,12 +195,6 @@ static inline bool tick_nohz_full_enabled(void) __ret; \ }) -static inline void tick_nohz_full_add_cpus_to (struct cpumask *mask) -{ -if (tick_nohz_full_enabled ()) -cpumask_or (mask, mask, tick_nohz_full_mask); -} -extern void tick_nohz_dep_set (enum tick_dep_bits bit);extern void tick_nohz_dep_clear (enum tick_dep_bits bit);extern void tick_nohz_dep_set_cpu (int cpu,enum tick_dep_bits bit);
@@ -281,7 +275,6 @@ extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);#else static inline bool tick_nohz_full_enabled (void ) {return false; }static inline bool tick_nohz_full_cpu (int cpu) {return false; } -static inline void tick_nohz_full_add_cpus_to (struct cpumask *mask) { }static inline void tick_nohz_dep_set_cpu (int cpu,enum tick_dep_bits bit) { }static inline void tick_nohz_dep_clear_cpu (int cpu,enum tick_dep_bits bit) { }
Signature · 1 line
2.47.1
PATCH 2/4 sched/isolation: clean up housekeeping_cpu
From: Alex Shi <[email protected]>
housekeeping_test_cpu will check 'housekeeping_overridden' again in itself so we don't need do it again outside. just call housekeeping_test_cpu is fine.
--- include/linux/sched/isolation.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
include/linux/sched/isolation.h +1 -5
@@ -63,11 +63,7 @@ static inline void housekeeping_init(void) { }static inline bool housekeeping_cpu (int cpu,enum hk_type type) { -#ifdef CONFIG_CPU_ISOLATION -if (static_branch_unlikely (&housekeeping_overridden)) -return housekeeping_test_cpu (cpu, type); -#endif -return true; +return housekeeping_test_cpu (cpu, type); }static inline bool cpu_is_isolated (int cpu)
Signature · 1 line
2.47.1
PATCH 3/4 sched/isolation: merge housekeeping_cpu() and housekeeping_test_cpu()
In reply to [email protected]From: Alex Shi <[email protected]>
Since the function just call housekeeping_test_cpu() without doing any other things, we could just merge them together with name housekeeping_cpu();
--- include/linux/sched/isolation.h | 19 +++++++------------ kernel/sched/isolation.c | 4 ++-- kernel/workqueue.c | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-)
include/linux/sched/isolation.h +7 -12
@@ -30,7 +30,7 @@ extern int housekeeping_any_cpu(enum hk_type type);extern const struct cpumask *housekeeping_cpumask (enum hk_type type);extern bool housekeeping_enabled (enum hk_type type);extern void housekeeping_affine (struct task_struct *t,enum hk_type type); -extern bool housekeeping_test_cpu (int cpu,enum hk_type type); +extern bool housekeeping_cpu (int cpu,enum hk_type type);extern void __init housekeeping_init (void );#else
@@ -50,26 +50,21 @@ static inline bool housekeeping_enabled(enum hk_type type) return false; } -static inline void housekeeping_affine (struct task_struct *t, -enum hk_type type) { } - -static inline bool housekeeping_test_cpu (int cpu,enum hk_type type) +static inline bool housekeeping_cpu (int cpu,enum hk_type type) {return true; } +static inline void housekeeping_affine (struct task_struct *t, +enum hk_type type) { } +static inline void housekeeping_init (void ) { }#endif /* CONFIG_CPU_ISOLATION */ -static inline bool housekeeping_cpu (int cpu,enum hk_type type) -{ -return housekeeping_test_cpu (cpu, type); -} -static inline bool cpu_is_isolated (int cpu) { -return !housekeeping_test_cpu (cpu,HK_TYPE_DOMAIN ) || - !housekeeping_test_cpu (cpu,HK_TYPE_TICK ) || +return !housekeeping_cpu (cpu,HK_TYPE_DOMAIN ) || + !housekeeping_cpu (cpu,HK_TYPE_TICK ) ||cpuset_cpu_is_isolated (cpu); }
kernel/sched/isolation.c +2 -2
@@ -73,14 +73,14 @@ void housekeeping_affine(struct task_struct *t, enum hk_type type) }EXPORT_SYMBOL_GPL (housekeeping_affine); -bool housekeeping_test_cpu (int cpu,enum hk_type type) +bool housekeeping_cpu (int cpu,enum hk_type type) {if (static_branch_unlikely (&housekeeping_overridden))if (housekeeping.flags &BIT (type))return cpumask_test_cpu (cpu, housekeeping.cpumasks[type]);return true; } -EXPORT_SYMBOL_GPL (housekeeping_test_cpu); +EXPORT_SYMBOL_GPL (housekeeping_cpu);void __init housekeeping_init (void ) {
kernel/workqueue.c +1 -1
@@ -2518,7 +2518,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,if (housekeeping_enabled (HK_TYPE_TIMER )) {/* If the current cpu is a housekeeping cpu, use it. */ cpu =smp_processor_id (); -if (!housekeeping_test_cpu (cpu,HK_TYPE_TIMER )) +if (!housekeeping_cpu (cpu,HK_TYPE_TIMER )) cpu =housekeeping_any_cpu (HK_TYPE_TIMER );add_timer_on (timer, cpu); }else {
Signature · 1 line
2.47.1
PATCH 4/4 sched/isolation: don't alloc twice for housekeeping.cpumasks
In reply to [email protected]From: Alex Shi <[email protected]>
The variable housekeeping.cpumasks[type] will be alloced twice if nohz_full and isolcpus are both setup in cmdline, that shouldn't to do so. Just alloc once is enough and save a bit memory.
--- kernel/sched/isolation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sched/isolation.c +3 -3
@@ -103,10 +103,10 @@ void __init housekeeping_init(void)static void __init housekeeping_setup_type (enum hk_type type,cpumask_var_t housekeeping_staging) { +if (cpumask_empty (housekeeping.cpumasks[type])) +alloc_bootmem_cpumask_var (&housekeeping.cpumasks[type]); -alloc_bootmem_cpumask_var (&housekeeping.cpumasks[type]); -cpumask_copy (housekeeping.cpumasks[type], - housekeeping_staging); +cpumask_copy (housekeeping.cpumasks[type], housekeeping_staging); }static int __init housekeeping_setup (char *str,unsigned long flags)
Signature · 1 line
2.47.1
Frederic Weisbecker
maintainerRe: [PATCH 2/4] sched/isolation: clean up housekeeping_cpu
In reply to [email protected]Quoted 5 lines · Le Thu, Apr 10, 2025 at 05:24:17PM +0800, [email protected] a écrit :
From: Alex Shi <[email protected]>
housekeeping_test_cpuwill check 'housekeeping_overridden' again in itself so we don't need do it again outside. just callhousekeeping_test_cpuis fine.
The point is to do it in the headers, so there is no function call in the off case.
Thanks.
Signature · 2 lines
Frederic Weisbecker SUSE Labs
Re: [PATCH 2/4] sched/isolation: clean up housekeeping_cpu
Quoted 10 lines · Frederic Weisbecker <[email protected]> 于2025年4月10日周四 21:20写道:
Quoted 5 lines · Le Thu, Apr 10, 2025 at 05:24:17PM +0800, [email protected] a écrit :
From: Alex Shi <[email protected]>
housekeeping_test_cpuwill check 'housekeeping_overridden' again in itself so we don't need do it again outside. just callhousekeeping_test_cpuis fine.The point is to do it in the headers, so there is no function call in the off case.
Thanks for comments, Frederic,
But the function is 'inline', and further more, the CONFIG_CPU_ISOLATION is in defconfig
and most of puplar popular Linux vendor. So it still be compiled.
Thanks
Frederic Weisbecker
maintainerRe: [PATCH 2/4] sched/isolation: clean up housekeeping_cpu
Quoted 9 lines · Alex Shi
Quoted 8 lines · Frederic Weisbecker <[email protected]> 于2025年4月10日周四 21:20写道:
Quoted 5 lines · Le Thu, Apr 10, 2025 at 05:24:17PM +0800, [email protected] a écrit :
From: Alex Shi <[email protected]>
housekeeping_test_cpuwill check 'housekeeping_overridden' again in itself so we don't need do it again outside. just callhousekeeping_test_cpuis fine.
Quoted 7 lines
Quoted 2 lines
The point is to do it in the headers, so there is no function call in the off case.
Thanks for comments, Frederic,
But the function is 'inline', and further more, theCONFIG_CPU_ISOLATIONis in defconfig
and most of puplar popular Linux vendor. So it still be compiled.
housekeeping_cpu() is inline and does the static branch test, which is most of the time off. If it's on, then we enter the slow path and call the real function housekeeping_test_cpu().
So the point is to optimize the fast path, which 99.999% of the uses since nohz_full is a rare workload.
But housekeeping_test_cpu() is still built on most distros just in case a distro user ever needs nohz_full.
Thanks.
Signature · 2 lines
Frederic Weisbecker SUSE Labs
[tip: timers/core] tick/nohz: Remove unused tick_nohz_full_add_cpus_to()
In reply to [email protected]The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 6c58d2791d6046727d87db50a5e46644f195dcf9 Gitweb: https://git.kernel.org/tip/6c58d2791d6046727d87db50a5e46644f195dcf9 Author: Alex Shi <[email protected]> AuthorDate: Thu, 10 Apr 2025 17:24:16 +08:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 13 May 2025 16:38:03 +02:00
tick/nohz: Remove unused tick_nohz_full_add_cpus_to()
This function isn't used anywhere. Remove it.
--- include/linux/tick.h | 7 ------- 1 file changed, 7 deletions(-)
include/linux/tick.h +0 -7
@@ -195,12 +195,6 @@ static inline bool tick_nohz_full_enabled(void) __ret; \ }) -static inline void tick_nohz_full_add_cpus_to (struct cpumask *mask) -{ -if (tick_nohz_full_enabled ()) -cpumask_or (mask, mask, tick_nohz_full_mask); -} -extern void tick_nohz_dep_set (enum tick_dep_bits bit);extern void tick_nohz_dep_clear (enum tick_dep_bits bit);extern void tick_nohz_dep_set_cpu (int cpu,enum tick_dep_bits bit);
@@ -281,7 +275,6 @@ extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);#else static inline bool tick_nohz_full_enabled (void ) {return false; }static inline bool tick_nohz_full_cpu (int cpu) {return false; } -static inline void tick_nohz_full_add_cpus_to (struct cpumask *mask) { }static inline void tick_nohz_dep_set_cpu (int cpu,enum tick_dep_bits bit) { }static inline void tick_nohz_dep_clear_cpu (int cpu,enum tick_dep_bits bit) { }