[PATCH 1/6] sched/fair: Join two #ifdef CONFIG_CFS_BANDWIDTH blocks

Ingo Molnar posted 6 patches 2 months, 1 week ago
[PATCH 1/6] sched/fair: Join two #ifdef CONFIG_CFS_BANDWIDTH blocks
Posted by Ingo Molnar 2 months, 1 week ago
Join two identical #ifdef blocks:

  #ifdef CONFIG_CFS_BANDWIDTH
  ...
  #endif

  #ifdef CONFIG_CFS_BANDWIDTH
  ...
  #endif

Also mark nested #ifdef blocks in the usual fashion, to make
it more apparent where in a nested hierarchy of #ifdefs we
are at a glance.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/sched.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index b419a4d98461..a29965c93832 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -726,9 +726,7 @@ struct cfs_rq {
 	unsigned long		h_load;
 	u64			last_h_load_update;
 	struct sched_entity	*h_load_next;
-#endif /* CONFIG_FAIR_GROUP_SCHED */
 
-#ifdef CONFIG_FAIR_GROUP_SCHED
 	struct rq		*rq;	/* CPU runqueue to which this cfs_rq is attached */
 
 	/*
@@ -746,14 +744,14 @@ struct cfs_rq {
 	/* Locally cached copy of our task_group's idle value */
 	int			idle;
 
-#ifdef CONFIG_CFS_BANDWIDTH
+# ifdef CONFIG_CFS_BANDWIDTH
 	int			runtime_enabled;
 	s64			runtime_remaining;
 
 	u64			throttled_pelt_idle;
-#ifndef CONFIG_64BIT
+#  ifndef CONFIG_64BIT
 	u64                     throttled_pelt_idle_copy;
-#endif
+#  endif
 	u64			throttled_clock;
 	u64			throttled_clock_pelt;
 	u64			throttled_clock_pelt_time;
@@ -765,7 +763,7 @@ struct cfs_rq {
 	struct list_head	throttled_list;
 	struct list_head	throttled_csd_list;
 	struct list_head        throttled_limbo_list;
-#endif /* CONFIG_CFS_BANDWIDTH */
+# endif /* CONFIG_CFS_BANDWIDTH */
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 };
 
-- 
2.51.0
Re: [PATCH 1/6] sched/fair: Join two #ifdef CONFIG_CFS_BANDWIDTH blocks
Posted by Shrikanth Hegde 2 months ago

On 12/1/25 12:16 PM, Ingo Molnar wrote:
> Join two identical #ifdef blocks:
> 
>    #ifdef CONFIG_CFS_BANDWIDTH
>    ...
>    #endif
> 
>    #ifdef CONFIG_CFS_BANDWIDTH
>    ...
>    #endif
> 

nit: I think it is CONFIG_FAIR_GROUP_SCHED here and in the subject line.

> Also mark nested #ifdef blocks in the usual fashion, to make
> it more apparent where in a nested hierarchy of #ifdefs we
> are at a glance.
> 
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>   kernel/sched/sched.h | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index b419a4d98461..a29965c93832 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -726,9 +726,7 @@ struct cfs_rq {
>   	unsigned long		h_load;
>   	u64			last_h_load_update;
>   	struct sched_entity	*h_load_next;
> -#endif /* CONFIG_FAIR_GROUP_SCHED */
>   
> -#ifdef CONFIG_FAIR_GROUP_SCHED
>   	struct rq		*rq;	/* CPU runqueue to which this cfs_rq is attached */
>   
>   	/*
> @@ -746,14 +744,14 @@ struct cfs_rq {
>   	/* Locally cached copy of our task_group's idle value */
>   	int			idle;
>   
> -#ifdef CONFIG_CFS_BANDWIDTH
> +# ifdef CONFIG_CFS_BANDWIDTH
>   	int			runtime_enabled;
>   	s64			runtime_remaining;
>   
>   	u64			throttled_pelt_idle;
> -#ifndef CONFIG_64BIT
> +#  ifndef CONFIG_64BIT
>   	u64                     throttled_pelt_idle_copy;
> -#endif
> +#  endif
>   	u64			throttled_clock;
>   	u64			throttled_clock_pelt;
>   	u64			throttled_clock_pelt_time;
> @@ -765,7 +763,7 @@ struct cfs_rq {
>   	struct list_head	throttled_list;
>   	struct list_head	throttled_csd_list;
>   	struct list_head        throttled_limbo_list;
> -#endif /* CONFIG_CFS_BANDWIDTH */
> +# endif /* CONFIG_CFS_BANDWIDTH */
>   #endif /* CONFIG_FAIR_GROUP_SCHED */
>   };
>   

Other than above nit,

Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Re: [PATCH 1/6] sched/fair: Join two #ifdef CONFIG_CFS_BANDWIDTH blocks
Posted by Ingo Molnar 2 months ago
* Shrikanth Hegde <sshegde@linux.ibm.com> wrote:

> On 12/1/25 12:16 PM, Ingo Molnar wrote:
> > Join two identical #ifdef blocks:
> >
> >    #ifdef CONFIG_CFS_BANDWIDTH
> >    ...
> >    #endif
> >
> >    #ifdef CONFIG_CFS_BANDWIDTH
> >    ...
> >    #endif
> >
>
> nit: I think it is CONFIG_FAIR_GROUP_SCHED here and in the subject line.

Indeed, fixed.

Thanks,

	Ingo
[tip: sched/core] sched/fair: Join two #ifdef CONFIG_FAIR_GROUP_SCHED blocks
Posted by tip-bot2 for Ingo Molnar 1 month, 3 weeks ago
The following commit has been merged into the sched/core branch of tip:

Commit-ID:     2b8c3d3dc9b1ee323e2982945088e3f5eebdf3dd
Gitweb:        https://git.kernel.org/tip/2b8c3d3dc9b1ee323e2982945088e3f5eebdf3dd
Author:        Ingo Molnar <mingo@kernel.org>
AuthorDate:    Wed, 26 Nov 2025 11:31:09 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Mon, 15 Dec 2025 07:52:44 +01:00

sched/fair: Join two #ifdef CONFIG_FAIR_GROUP_SCHED blocks

Join two identical #ifdef blocks:

  #ifdef CONFIG_FAIR_GROUP_SCHED
  ...
  #endif

  #ifdef CONFIG_FAIR_GROUP_SCHED
  ...
  #endif

Also mark nested #ifdef blocks in the usual fashion, to make
it more apparent where in a nested hierarchy of #ifdefs we
are at a glance.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://patch.msgid.link/20251201064647.1851919-2-mingo@kernel.org
---
 kernel/sched/sched.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index a40582d..2173e3d 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -726,9 +726,7 @@ struct cfs_rq {
 	unsigned long		h_load;
 	u64			last_h_load_update;
 	struct sched_entity	*h_load_next;
-#endif /* CONFIG_FAIR_GROUP_SCHED */
 
-#ifdef CONFIG_FAIR_GROUP_SCHED
 	struct rq		*rq;	/* CPU runqueue to which this cfs_rq is attached */
 
 	/*
@@ -746,14 +744,14 @@ struct cfs_rq {
 	/* Locally cached copy of our task_group's idle value */
 	int			idle;
 
-#ifdef CONFIG_CFS_BANDWIDTH
+# ifdef CONFIG_CFS_BANDWIDTH
 	int			runtime_enabled;
 	s64			runtime_remaining;
 
 	u64			throttled_pelt_idle;
-#ifndef CONFIG_64BIT
+#  ifndef CONFIG_64BIT
 	u64                     throttled_pelt_idle_copy;
-#endif
+#  endif
 	u64			throttled_clock;
 	u64			throttled_clock_pelt;
 	u64			throttled_clock_pelt_time;
@@ -765,7 +763,7 @@ struct cfs_rq {
 	struct list_head	throttled_list;
 	struct list_head	throttled_csd_list;
 	struct list_head        throttled_limbo_list;
-#endif /* CONFIG_CFS_BANDWIDTH */
+# endif /* CONFIG_CFS_BANDWIDTH */
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 };
 
[tip: sched/core] sched/fair: Join two #ifdef CONFIG_FAIR_GROUP_SCHED blocks
Posted by tip-bot2 for Ingo Molnar 1 month, 3 weeks ago
The following commit has been merged into the sched/core branch of tip:

Commit-ID:     7e1f73851205657e90e34a4013d86d129ed514a1
Gitweb:        https://git.kernel.org/tip/7e1f73851205657e90e34a4013d86d129ed514a1
Author:        Ingo Molnar <mingo@kernel.org>
AuthorDate:    Wed, 26 Nov 2025 11:31:09 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Sun, 14 Dec 2025 08:25:02 +01:00

sched/fair: Join two #ifdef CONFIG_FAIR_GROUP_SCHED blocks

Join two identical #ifdef blocks:

  #ifdef CONFIG_FAIR_GROUP_SCHED
  ...
  #endif

  #ifdef CONFIG_FAIR_GROUP_SCHED
  ...
  #endif

Also mark nested #ifdef blocks in the usual fashion, to make
it more apparent where in a nested hierarchy of #ifdefs we
are at a glance.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://patch.msgid.link/20251201064647.1851919-2-mingo@kernel.org
---
 kernel/sched/sched.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 467ea31..f751ac3 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -726,9 +726,7 @@ struct cfs_rq {
 	unsigned long		h_load;
 	u64			last_h_load_update;
 	struct sched_entity	*h_load_next;
-#endif /* CONFIG_FAIR_GROUP_SCHED */
 
-#ifdef CONFIG_FAIR_GROUP_SCHED
 	struct rq		*rq;	/* CPU runqueue to which this cfs_rq is attached */
 
 	/*
@@ -746,14 +744,14 @@ struct cfs_rq {
 	/* Locally cached copy of our task_group's idle value */
 	int			idle;
 
-#ifdef CONFIG_CFS_BANDWIDTH
+# ifdef CONFIG_CFS_BANDWIDTH
 	int			runtime_enabled;
 	s64			runtime_remaining;
 
 	u64			throttled_pelt_idle;
-#ifndef CONFIG_64BIT
+#  ifndef CONFIG_64BIT
 	u64                     throttled_pelt_idle_copy;
-#endif
+#  endif
 	u64			throttled_clock;
 	u64			throttled_clock_pelt;
 	u64			throttled_clock_pelt_time;
@@ -765,7 +763,7 @@ struct cfs_rq {
 	struct list_head	throttled_list;
 	struct list_head	throttled_csd_list;
 	struct list_head        throttled_limbo_list;
-#endif /* CONFIG_CFS_BANDWIDTH */
+# endif /* CONFIG_CFS_BANDWIDTH */
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 };