[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4252417f-014a-4054-a61f-918a6a8f8e86@redhat.com>
Date: Wed, 29 Oct 2025 10:56:03 -0400
From: Waiman Long <llong@...hat.com>
To: Pingfan Liu <piliu@...hat.com>, linux-kernel@...r.kernel.org
Cc: Peter Zijlstra <peterz@...radead.org>, Juri Lelli
 <juri.lelli@...hat.com>, Pierre Gondois <pierre.gondois@....com>,
 Frederic Weisbecker <frederic@...nel.org>, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCHv4 1/2] sched/isolation: Split out the housekeeping part
On 10/27/25 11:43 PM, Pingfan Liu wrote:
> A later patch will introduce a function in cpuset.h that refers to
> definitions in isolation.h. This would cause a circular header file
> inclusion issue.  To break the cycle, move the definitions into a
> dedicated file called 'housekeeping.h'."
>
> Signed-off-by: Pingfan Liu <piliu@...hat.com>
> Cc: Waiman Long <longman@...hat.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Juri Lelli <juri.lelli@...hat.com>
> Cc: Pierre Gondois <pierre.gondois@....com>
> Cc: Frederic Weisbecker <frederic@...nel.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> To: linux-kernel@...r.kernel.org
> ---
>   include/linux/sched/housekeeping.h | 67 ++++++++++++++++++++++++++++++
>   include/linux/sched/isolation.h    | 65 +----------------------------
>   2 files changed, 68 insertions(+), 64 deletions(-)
>   create mode 100644 include/linux/sched/housekeeping.h
I would like not to introduce a new header file if possible. The 
circular dependency is due to the fact that cpu_is_isolated() is now 
calling cpuset_cpu_is_isolated() to get the list of CPUs in isolated 
partitions. However, Frederic has a patch series that is going to remove 
cpuset_cpu_is_isolated() and so the "linux/cpuset.h" include in 
isolation.h can be removed as well.
Cheers,
Longman
>
> diff --git a/include/linux/sched/housekeeping.h b/include/linux/sched/housekeeping.h
> new file mode 100644
> index 0000000000000..99cfc8821a814
> --- /dev/null
> +++ b/include/linux/sched/housekeeping.h
> @@ -0,0 +1,67 @@
> +#ifndef _LINUX_SCHED_HOUSEKEEPING_H
> +#define _LINUX_SCHED_HOUSEKEEPING_H
> +
> +enum hk_type {
> +	HK_TYPE_DOMAIN,
> +	HK_TYPE_MANAGED_IRQ,
> +	HK_TYPE_KERNEL_NOISE,
> +	HK_TYPE_MAX,
> +
> +	/*
> +	 * The following housekeeping types are only set by the nohz_full
> +	 * boot commandline option. So they can share the same value.
> +	 */
> +	HK_TYPE_TICK    = HK_TYPE_KERNEL_NOISE,
> +	HK_TYPE_TIMER   = HK_TYPE_KERNEL_NOISE,
> +	HK_TYPE_RCU     = HK_TYPE_KERNEL_NOISE,
> +	HK_TYPE_MISC    = HK_TYPE_KERNEL_NOISE,
> +	HK_TYPE_WQ      = HK_TYPE_KERNEL_NOISE,
> +	HK_TYPE_KTHREAD = HK_TYPE_KERNEL_NOISE
> +};
> +
> +#ifdef CONFIG_CPU_ISOLATION
> +DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
> +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 void __init housekeeping_init(void);
> +
> +#else
> +
> +static inline int housekeeping_any_cpu(enum hk_type type)
> +{
> +	return smp_processor_id();
> +}
> +
> +static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
> +{
> +	return cpu_possible_mask;
> +}
> +
> +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)
> +{
> +	return true;
> +}
> +
> +static inline void housekeeping_init(void) { }
> +#endif /* CONFIG_CPU_ISOLATION */
> +
> +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;
> +}
> +#endif
> diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
> index d8501f4709b58..e07b2c439365d 100644
> --- a/include/linux/sched/isolation.h
> +++ b/include/linux/sched/isolation.h
> @@ -5,70 +5,7 @@
>   #include <linux/cpuset.h>
>   #include <linux/init.h>
>   #include <linux/tick.h>
> -
> -enum hk_type {
> -	HK_TYPE_DOMAIN,
> -	HK_TYPE_MANAGED_IRQ,
> -	HK_TYPE_KERNEL_NOISE,
> -	HK_TYPE_MAX,
> -
> -	/*
> -	 * The following housekeeping types are only set by the nohz_full
> -	 * boot commandline option. So they can share the same value.
> -	 */
> -	HK_TYPE_TICK    = HK_TYPE_KERNEL_NOISE,
> -	HK_TYPE_TIMER   = HK_TYPE_KERNEL_NOISE,
> -	HK_TYPE_RCU     = HK_TYPE_KERNEL_NOISE,
> -	HK_TYPE_MISC    = HK_TYPE_KERNEL_NOISE,
> -	HK_TYPE_WQ      = HK_TYPE_KERNEL_NOISE,
> -	HK_TYPE_KTHREAD = HK_TYPE_KERNEL_NOISE
> -};
> -
> -#ifdef CONFIG_CPU_ISOLATION
> -DECLARE_STATIC_KEY_FALSE(housekeeping_overridden);
> -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 void __init housekeeping_init(void);
> -
> -#else
> -
> -static inline int housekeeping_any_cpu(enum hk_type type)
> -{
> -	return smp_processor_id();
> -}
> -
> -static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
> -{
> -	return cpu_possible_mask;
> -}
> -
> -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)
> -{
> -	return true;
> -}
> -
> -static inline void housekeeping_init(void) { }
> -#endif /* CONFIG_CPU_ISOLATION */
> -
> -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;
> -}
> +#include <linux/sched/housekeeping.h>
>   
>   static inline bool cpu_is_isolated(int cpu)
>   {
Powered by blists - more mailing lists
 
