Skip to contentSkip to conversation

sched: core: fix compilation error when cgroup not selected

PATCH Applied Qais Yousef 4 participants 5 messages Nov 5, 2019 – Nov 8, 2019 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: core: fix compilation error when cgroup not selected

When cgroup is disabled the following compilation error was hit

	kernel/sched/core.c: In function ‘uclamp_update_active_tasks’:
	kernel/sched/core.c:1081:23: error: storage size of ‘it’ isn’t known
	  struct css_task_iter it;
			       ^~
	kernel/sched/core.c:1084:2: error: implicit declaration of function ‘css_task_iter_start’; did you mean ‘__sg_page_iter_start’? [-Werror=implicit-function-declaration]
	  css_task_iter_start(css, 0, &it);
	  ^~~~~~~~~~~~~~~~~~~
	  __sg_page_iter_start
	kernel/sched/core.c:1085:14: error: implicit declaration of function ‘css_task_iter_next’; did you mean ‘__sg_page_iter_next’? [-Werror=implicit-function-declaration]
	  while ((p = css_task_iter_next(&it))) {
		      ^~~~~~~~~~~~~~~~~~
		      __sg_page_iter_next
	kernel/sched/core.c:1091:2: error: implicit declaration of function ‘css_task_iter_end’; did you mean ‘get_task_cred’? [-Werror=implicit-function-declaration]
	  css_task_iter_end(&it);
	  ^~~~~~~~~~~~~~~~~
	  get_task_cred
	kernel/sched/core.c:1081:23: warning: unused variable ‘it’ [-Wunused-variable]
	  struct css_task_iter it;
			       ^~
	cc1: some warnings being treated as errors
	make[2]: *** [kernel/sched/core.o] Error 1

Fix by protetion uclamp_update_active_tasks() with CONFIG_UCLAMP_TASK_GROUP

Fixes babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index dd05a378631a..afd4d8028771 100644
@@ -1073,6 +1073,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
 	task_rq_unlock(rq, p, &rf);
 }
 
+#ifdef CONFIG_UCLAMP_TASK_GROUP
 static inline void
 uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 			   unsigned int clamps)
@@ -1091,7 +1092,6 @@ uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 	css_task_iter_end(&it);
 }
 
-#ifdef CONFIG_UCLAMP_TASK_GROUP
 static void cpu_util_update_eff(struct cgroup_subsys_state *css);
 static void uclamp_update_root_tg(void)
 {
Signature · 1 line
2.17.1
Tested-by Randy Dunlap on v1 1/1
#1 lore raw

[ +Randy ]

Hi Qais,

Quoted 24 lines · Qais Yousef

When cgroup is disabled the following compilation error was hit

	kernel/sched/core.c: In function ‘uclamp_update_active_tasks’:
	kernel/sched/core.c:1081:23: error: storage size of ‘it’ isn’t known
	  struct css_task_iter it;
			       ^~
	kernel/sched/core.c:1084:2: error: implicit declaration of function ‘css_task_iter_start’; did you mean ‘__sg_page_iter_start’? [-Werror=implicit-function-declaration]
	  css_task_iter_start(css, 0, &it);
	  ^~~~~~~~~~~~~~~~~~~
	  __sg_page_iter_start
	kernel/sched/core.c:1085:14: error: implicit declaration of function ‘css_task_iter_next’; did you mean ‘__sg_page_iter_next’? [-Werror=implicit-function-declaration]
	  while ((p = css_task_iter_next(&it))) {
		      ^~~~~~~~~~~~~~~~~~
		      __sg_page_iter_next
	kernel/sched/core.c:1091:2: error: implicit declaration of function ‘css_task_iter_end’; did you mean ‘get_task_cred’? [-Werror=implicit-function-declaration]
	  css_task_iter_end(&it);
	  ^~~~~~~~~~~~~~~~~
	  get_task_cred
	kernel/sched/core.c:1081:23: warning: unused variable ‘it’ [-Wunused-variable]
	  struct css_task_iter it;
			       ^~
	cc1: some warnings being treated as errors
	make[2]: *** [kernel/sched/core.o] Error 1
Quoted 5 lines

Fix by protetion uclamp_update_active_tasks() with CONFIG_UCLAMP_TASK_GROUP

Fixes babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")

Thanks for posting this again.

We now have three "versions" of this same fix, including:
- the original bug report by Randy and a fix from me here:
Message-ID: <[email protected]>
https://lore.kernel.org/linux-next/[email protected]/
- and a follow up patch from Arnd:
Message-ID: <[email protected]>
https://lore.kernel.org/lkml/[email protected]/

So, I guess now we just have to pick the one with the changelog we prefer. :)

In all cases we should probably add:

Best,
Patrick

Quoted 27 lines
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index dd05a378631a..afd4d8028771 100644
@@ -1073,6 +1073,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
 	task_rq_unlock(rq, p, &rf);
 }
 
+#ifdef CONFIG_UCLAMP_TASK_GROUP
 static inline void
 uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 			   unsigned int clamps)
@@ -1091,7 +1092,6 @@ uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 	css_task_iter_end(&it);
 }
 
-#ifdef CONFIG_UCLAMP_TASK_GROUP
 static void cpu_util_update_eff(struct cgroup_subsys_state *css);
 static void uclamp_update_root_tg(void)
 {
Signature · 1 line
2.17.1
Signature · 3 lines
#include <best/regards.h>

Patrick Bellasi
#2 lore raw

Hi Patrick

On 11/07/19 07:25, Patrick Bellasi wrote:

[...]

Quoted 9 lines

Thanks for posting this again.

We now have three "versions" of this same fix, including:
- the original bug report by Randy and a fix from me here:

   Message-ID: <[email protected]>
   https://lore.kernel.org/linux-next/[email protected]/
 - and a follow up patch from Arnd:
   Message-ID: <[email protected]>
   https://lore.kernel.org/lkml/[email protected]/

Oh I should have done my homework better. FWIW I caught this on 5.4-rc6 so that's why I didn't think there was a fix posted.

I don't mind which version gets picked. But if it can go in before 5.4 is released that'd be great.

Thanks

--
Qais Yousef

maintainer
#3 lore raw
In reply to Patrick Bellasi
Quoted 45 lines · Patrick Bellasi

[ +Randy ]

Hi Qais,

Quoted 24 lines · Qais Yousef

When cgroup is disabled the following compilation error was hit

	kernel/sched/core.c: In function ‘uclamp_update_active_tasks’:
	kernel/sched/core.c:1081:23: error: storage size of ‘it’ isn’t known
	  struct css_task_iter it;
			       ^~
	kernel/sched/core.c:1084:2: error: implicit declaration of function ‘css_task_iter_start’; did you mean ‘__sg_page_iter_start’? [-Werror=implicit-function-declaration]
	  css_task_iter_start(css, 0, &it);
	  ^~~~~~~~~~~~~~~~~~~
	  __sg_page_iter_start
	kernel/sched/core.c:1085:14: error: implicit declaration of function ‘css_task_iter_next’; did you mean ‘__sg_page_iter_next’? [-Werror=implicit-function-declaration]
	  while ((p = css_task_iter_next(&it))) {
		      ^~~~~~~~~~~~~~~~~~
		      __sg_page_iter_next
	kernel/sched/core.c:1091:2: error: implicit declaration of function ‘css_task_iter_end’; did you mean ‘get_task_cred’? [-Werror=implicit-function-declaration]
	  css_task_iter_end(&it);
	  ^~~~~~~~~~~~~~~~~
	  get_task_cred
	kernel/sched/core.c:1081:23: warning: unused variable ‘it’ [-Wunused-variable]
	  struct css_task_iter it;
			       ^~
	cc1: some warnings being treated as errors
	make[2]: *** [kernel/sched/core.o] Error 1
Quoted 5 lines

Fix by protetion uclamp_update_active_tasks() with CONFIG_UCLAMP_TASK_GROUP

Fixes babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")

Thanks for posting this again.

We now have three "versions" of this same fix, including:
- the original bug report by Randy and a fix from me here:

   Message-ID: <[email protected]>
   https://lore.kernel.org/linux-next/[email protected]/
 - and a follow up patch from Arnd:
   Message-ID: <[email protected]>
   https://lore.kernel.org/lkml/[email protected]/
Quoted 7 lines

So, I guess now we just have to pick the one with the changelog we prefer. :)

In all cases we should probably add:

Argh, ok, I missed them all too. Picked up this one for sched/urgent and added the above.

Thanks!

merge bot Applied
#4 lore raw

[tip: sched/urgent] sched/core: Fix compilation error when cgroup not selected

In reply to Qais Yousef
The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     e3b8b6a0d12cccf772113d6b5c1875192186fbd4
Gitweb:        https://git.kernel.org/tip/e3b8b6a0d12cccf772113d6b5c1875192186fbd4
Author:        Qais Yousef <[email protected]>
AuthorDate:    Tue, 05 Nov 2019 11:22:12 
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Fri, 08 Nov 2019 22:34:14 +01:00

sched/core: Fix compilation error when cgroup not selected

When cgroup is disabled the following compilation error was hit

	kernel/sched/core.c: In function ‘uclamp_update_active_tasks’:
	kernel/sched/core.c:1081:23: error: storage size of ‘it’ isn’t known
	  struct css_task_iter it;
			       ^~
	kernel/sched/core.c:1084:2: error: implicit declaration of function ‘css_task_iter_start’; did you mean ‘__sg_page_iter_start’? [-Werror=implicit-function-declaration]
	  css_task_iter_start(css, 0, &it);
	  ^~~~~~~~~~~~~~~~~~~
	  __sg_page_iter_start
	kernel/sched/core.c:1085:14: error: implicit declaration of function ‘css_task_iter_next’; did you mean ‘__sg_page_iter_next’? [-Werror=implicit-function-declaration]
	  while ((p = css_task_iter_next(&it))) {
		      ^~~~~~~~~~~~~~~~~~
		      __sg_page_iter_next
	kernel/sched/core.c:1091:2: error: implicit declaration of function ‘css_task_iter_end’; did you mean ‘get_task_cred’? [-Werror=implicit-function-declaration]
	  css_task_iter_end(&it);
	  ^~~~~~~~~~~~~~~~~
	  get_task_cred
	kernel/sched/core.c:1081:23: warning: unused variable ‘it’ [-Wunused-variable]
	  struct css_task_iter it;
			       ^~
	cc1: some warnings being treated as errors
	make[2]: *** [kernel/sched/core.o] Error 1

Fix by protetion uclamp_update_active_tasks() with CONFIG_UCLAMP_TASK_GROUP

Fixes babbe170e053 ("sched/uclamp: Update CPU's refcount on TG's clamp changes")
Cc Steven Rostedt <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Patrick Bellasi <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Dietmar Eggemann <[email protected]>
Cc Juri Lelli <[email protected]>
Cc Ben Segall <[email protected]>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index dd05a37..afd4d80 100644
@@ -1073,6 +1073,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
 	task_rq_unlock(rq, p, &rf);
 }
 
+#ifdef CONFIG_UCLAMP_TASK_GROUP
 static inline void
 uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 			   unsigned int clamps)
@@ -1091,7 +1092,6 @@ uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 	css_task_iter_end(&it);
 }
 
-#ifdef CONFIG_UCLAMP_TASK_GROUP
 static void cpu_util_update_eff(struct cgroup_subsys_state *css);
 static void uclamp_update_root_tg(void)
 {