Re: [PATCH] sched: core: fix compilation error when cgroup not selected

From: Peter Zijlstra
Date: Thu Nov 07 2019 - 08:12:06 EST


On Thu, Nov 07, 2019 at 07:25:25AM +0000, Patrick Bellasi wrote:
> [ +Randy ]
>
> Hi Qais,
>
> On 05-Nov 11:22, Qais Yousef wrote:
> > 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")
> > Signed-off-by: Qais Yousef <qais.yousef@xxxxxxx>
>
> 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: <8736gv2gbv.fsf@xxxxxxx>
> https://lore.kernel.org/linux-next/8736gv2gbv.fsf@xxxxxxx/
> - and a follow up patch from Arnd:
> Message-ID: <20190918195957.2220297-1-arnd@xxxxxxxx>
> https://lore.kernel.org/lkml/20190918195957.2220297-1-arnd@xxxxxxxx/
>
> So, I guess now we just have to pick the one with the changelog we
> prefer. :)
>
> In all cases we should probably add:
>
> Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Tested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

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

Thanks!