lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 23 May 2023 12:28:01 +0530
From:   Mukesh Ojha <quic_mojha@...cinc.com>
To:     Arnd Bergmann <arnd@...nel.org>, Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>
CC:     Arnd Bergmann <arnd@...db.de>, Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/5] sched: fair: move unused stub functions to header



On 5/23/2023 1:20 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> These four functions have a normal definition for CONFIG_FAIR_GROUP_SCHED,
> and empty one that is only referenced when FAIR_GROUP_SCHED is disabled
> but CGROUP_SCHED is still enabled. If both are turned off, the functions
> are still defined but the misisng prototype causes a W=1 warning:

missing ?

> 
> kernel/sched/fair.c:12544:6: error: no previous prototype for 'free_fair_sched_group'
> kernel/sched/fair.c:12546:5: error: no previous prototype for 'alloc_fair_sched_group'
> kernel/sched/fair.c:12553:6: error: no previous prototype for 'online_fair_sched_group'
> kernel/sched/fair.c:12555:6: error: no previous prototype for 'unregister_fair_sched_group'
> 
> Move the alternatives into the header as static inline functions with
> the correct combination of #ifdef checks to avoid the warning without
> adding even more complexity.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

LGTM.

Reviewed-by: Mukesh Ojha <quic_mojha@...cinc.com>

-- Mukesh

> ---
>   kernel/sched/fair.c  | 13 -------------
>   kernel/sched/sched.h | 11 +++++++++++
>   2 files changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a7a8ccde3bd7..bae8907c1635 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12602,19 +12602,6 @@ int sched_group_set_idle(struct task_group *tg, long idle)
>   	return 0;
>   }
>   
> -#else /* CONFIG_FAIR_GROUP_SCHED */
> -
> -void free_fair_sched_group(struct task_group *tg) { }
> -
> -int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
> -{
> -	return 1;
> -}
> -
> -void online_fair_sched_group(struct task_group *tg) { }
> -
> -void unregister_fair_sched_group(struct task_group *tg) { }
> -
>   #endif /* CONFIG_FAIR_GROUP_SCHED */
>   
>   
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index d5ac0af1eede..0584fa15ffeb 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -453,10 +453,21 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)
>   
>   extern int tg_nop(struct task_group *tg, void *data);
>   
> +#ifdef CONFIG_FAIR_GROUP_SCHED
>   extern void free_fair_sched_group(struct task_group *tg);
>   extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent);
>   extern void online_fair_sched_group(struct task_group *tg);
>   extern void unregister_fair_sched_group(struct task_group *tg);
> +#else
> +static inline void free_fair_sched_group(struct task_group *tg) { }
> +static inline int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
> +{
> +       return 1;
> +}
> +static inline void online_fair_sched_group(struct task_group *tg) { }
> +static inline void unregister_fair_sched_group(struct task_group *tg) { }
> +#endif
> +
>   extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
>   			struct sched_entity *se, int cpu,
>   			struct sched_entity *parent);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ