public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] sched: Fix compilation error
@ 2024-09-23 13:54 Yu Liao
  2024-09-23 13:54 ` [RFC PATCH 1/2] sched: Add dummy version of sched_group_set_idle() Yu Liao
  2024-09-23 13:54 ` [RFC PATCH 2/2] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT Yu Liao
  0 siblings, 2 replies; 5+ messages in thread
From: Yu Liao @ 2024-09-23 13:54 UTC (permalink / raw)
  To: tj
  Cc: liaoyu15, xiexiuqi, peterz, mingo, linux-kernel, juri.lelli,
	vincent.guittot

This series fix the compilation issues when building with
CONFIG_CGROUP_SCHED_WEIGHT && !CONFIG_FAIR_GROUP_SCHED.

Yu Liao (2):
  sched: Add dummy version of sched_group_set_idle()
  sched: Put sched_group::idle under CONFIG_GROUP_SCHED_WEIGHT

 kernel/sched/sched.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC PATCH 1/2] sched: Add dummy version of sched_group_set_idle()
  2024-09-23 13:54 [RFC PATCH 0/2] sched: Fix compilation error Yu Liao
@ 2024-09-23 13:54 ` Yu Liao
  2024-09-23 15:25   ` Tejun Heo
  2024-09-23 13:54 ` [RFC PATCH 2/2] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT Yu Liao
  1 sibling, 1 reply; 5+ messages in thread
From: Yu Liao @ 2024-09-23 13:54 UTC (permalink / raw)
  To: tj
  Cc: liaoyu15, xiexiuqi, peterz, mingo, linux-kernel, juri.lelli,
	vincent.guittot

Fix the following error when build with CONFIG_GROUP_SCHED_WEIGHT &&
!CONFIG_FAIR_GROUP_SCHED:

kernel/sched/core.c:9634:15: error: implicit declaration of function
'sched_group_set_idle'; did you mean 'scx_group_set_idle'? [-Wimplicit-function-declaration]
  9634 |         ret = sched_group_set_idle(css_tg(css), idle);
       |               ^~~~~~~~~~~~~~~~~~~~
       |               scx_group_set_idle

Fixes: e179e80c5d4f ("sched: Introduce CONFIG_GROUP_SCHED_WEIGHT")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409220859.UiCAoFOW-lkp@intel.com/
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
---
 kernel/sched/sched.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 8063db62b027..91d14061fdca 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -582,6 +582,7 @@ static inline void set_task_rq_fair(struct sched_entity *se,
 #endif /* CONFIG_SMP */
 #else /* !CONFIG_FAIR_GROUP_SCHED */
 static inline int sched_group_set_shares(struct task_group *tg, unsigned long shares) { return 0; }
+static inline int sched_group_set_idle(struct task_group *tg, long idle) { return 0; }
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 
 #else /* CONFIG_CGROUP_SCHED */
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC PATCH 2/2] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT
  2024-09-23 13:54 [RFC PATCH 0/2] sched: Fix compilation error Yu Liao
  2024-09-23 13:54 ` [RFC PATCH 1/2] sched: Add dummy version of sched_group_set_idle() Yu Liao
@ 2024-09-23 13:54 ` Yu Liao
  2024-09-23 15:28   ` Tejun Heo
  1 sibling, 1 reply; 5+ messages in thread
From: Yu Liao @ 2024-09-23 13:54 UTC (permalink / raw)
  To: tj
  Cc: liaoyu15, xiexiuqi, peterz, mingo, linux-kernel, juri.lelli,
	vincent.guittot

When build with CONFIG_GROUP_SCHED_WEIGHT && !CONFIG_FAIR_GROUP_SCHED,
the idle member is not defined:

kernel/sched/ext.c:3701:16: error: 'struct task_group' has no member named 'idle'
  3701 |         if (!tg->idle)
       |                ^~

Fix this by putting 'idle' under new CONFIG_GROUP_SCHED_WEIGHT, this
doesn't modify the layout of struct task_group.

Fixes: e179e80c5d4f ("sched: Introduce CONFIG_GROUP_SCHED_WEIGHT")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409220859.UiCAoFOW-lkp@intel.com/
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
---
 kernel/sched/sched.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 91d14061fdca..fb871677ba22 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -438,11 +438,14 @@ struct task_group {
 	/* runqueue "owned" by this group on each CPU */
 	struct cfs_rq		**cfs_rq;
 	unsigned long		shares;
+#endif
 
+#ifdef CONFIG_GROUP_SCHED_WEIGHT
 	/* A positive value indicates that this is a SCHED_IDLE group. */
 	int			idle;
+#endif
 
-#ifdef	CONFIG_SMP
+#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
 	/*
 	 * load_avg can be heavily contended at clock tick time, so put
 	 * it in its own cache-line separated from the fields above which
@@ -450,7 +453,6 @@ struct task_group {
 	 */
 	atomic_long_t		load_avg ____cacheline_aligned;
 #endif
-#endif
 
 #ifdef CONFIG_RT_GROUP_SCHED
 	struct sched_rt_entity	**rt_se;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH 1/2] sched: Add dummy version of sched_group_set_idle()
  2024-09-23 13:54 ` [RFC PATCH 1/2] sched: Add dummy version of sched_group_set_idle() Yu Liao
@ 2024-09-23 15:25   ` Tejun Heo
  0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2024-09-23 15:25 UTC (permalink / raw)
  To: Yu Liao; +Cc: xiexiuqi, peterz, mingo, linux-kernel, juri.lelli,
	vincent.guittot

On Mon, Sep 23, 2024 at 09:54:30PM +0800, Yu Liao wrote:
> Fix the following error when build with CONFIG_GROUP_SCHED_WEIGHT &&
> !CONFIG_FAIR_GROUP_SCHED:
> 
> kernel/sched/core.c:9634:15: error: implicit declaration of function
> 'sched_group_set_idle'; did you mean 'scx_group_set_idle'? [-Wimplicit-function-declaration]
>   9634 |         ret = sched_group_set_idle(css_tg(css), idle);
>        |               ^~~~~~~~~~~~~~~~~~~~
>        |               scx_group_set_idle
> 
> Fixes: e179e80c5d4f ("sched: Introduce CONFIG_GROUP_SCHED_WEIGHT")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202409220859.UiCAoFOW-lkp@intel.com/
> Signed-off-by: Yu Liao <liaoyu15@huawei.com>

Applied to sched_ext/for-6.12.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH 2/2] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT
  2024-09-23 13:54 ` [RFC PATCH 2/2] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT Yu Liao
@ 2024-09-23 15:28   ` Tejun Heo
  0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2024-09-23 15:28 UTC (permalink / raw)
  To: Yu Liao; +Cc: xiexiuqi, peterz, mingo, linux-kernel, juri.lelli,
	vincent.guittot

Hello,

I applied the patch to sched_ext/for-6.12-fixes with some edits. There's no
strong reason to keep idle in that particular location and it's easier to
move it upward out of CONFIG_FAIR_GROUP_SCHED block.

Thanks.

------ 8< ------
From 7ebd84d627e40cb9fb12b338588e81b6cca371e3 Mon Sep 17 00:00:00 2001
From: Yu Liao <liaoyu15@huawei.com>
Date: Mon, 23 Sep 2024 21:54:31 +0800
Subject: [PATCH] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT

When build with CONFIG_GROUP_SCHED_WEIGHT && !CONFIG_FAIR_GROUP_SCHED,
the idle member is not defined:

kernel/sched/ext.c:3701:16: error: 'struct task_group' has no member named 'idle'
  3701 |         if (!tg->idle)
       |                ^~

Fix this by putting 'idle' under new CONFIG_GROUP_SCHED_WEIGHT.

tj: Move idle field upward to avoid breaking up CONFIG_FAIR_GROUP_SCHED block.

Fixes: e179e80c5d4f ("sched: Introduce CONFIG_GROUP_SCHED_WEIGHT")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409220859.UiCAoFOW-lkp@intel.com/
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
 kernel/sched/sched.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 91d14061fdca..b1c3588a8f00 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -432,16 +432,17 @@ struct cfs_bandwidth {
 struct task_group {
 	struct cgroup_subsys_state css;
 
+#ifdef CONFIG_GROUP_SCHED_WEIGHT
+	/* A positive value indicates that this is a SCHED_IDLE group. */
+	int			idle;
+#endif
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	/* schedulable entities of this group on each CPU */
 	struct sched_entity	**se;
 	/* runqueue "owned" by this group on each CPU */
 	struct cfs_rq		**cfs_rq;
 	unsigned long		shares;
-
-	/* A positive value indicates that this is a SCHED_IDLE group. */
-	int			idle;
-
 #ifdef	CONFIG_SMP
 	/*
 	 * load_avg can be heavily contended at clock tick time, so put
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-23 15:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 13:54 [RFC PATCH 0/2] sched: Fix compilation error Yu Liao
2024-09-23 13:54 ` [RFC PATCH 1/2] sched: Add dummy version of sched_group_set_idle() Yu Liao
2024-09-23 15:25   ` Tejun Heo
2024-09-23 13:54 ` [RFC PATCH 2/2] sched: Put task_group::idle under CONFIG_GROUP_SCHED_WEIGHT Yu Liao
2024-09-23 15:28   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox