Re: [PATCH 1/3] sched/fair: Move __cfs_bandwidth_used to new static key API

From: Benjamin Segall

Date: Tue Jul 21 2026 - 20:08:34 EST


Hongyan Xia <hongyan.xia@xxxxxxxxxxxxx> writes:

> From: Hongyan Xia <hongyan.xia@xxxxxxxxxxxxx>
>
> Using struct static_key directly is deprecated. Fix.
>
> No functional change.
>
> Signed-off-by: Hongyan Xia <hongyan.xia@xxxxxxxxxxxxx>

Reviewed-By: Ben Segall <bsegall@xxxxxxxxxx>

> ---
> kernel/sched/fair.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 422284fb815f..e03c2610d2c3 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6442,21 +6442,21 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
> #ifdef CONFIG_CFS_BANDWIDTH
>
> #ifdef CONFIG_JUMP_LABEL
> -static struct static_key __cfs_bandwidth_used;
> +static DEFINE_STATIC_KEY_FALSE(__cfs_bandwidth_used);
>
> static inline bool cfs_bandwidth_used(void)
> {
> - return static_key_false(&__cfs_bandwidth_used);
> + return static_branch_unlikely(&__cfs_bandwidth_used);
> }
>
> void cfs_bandwidth_usage_inc(void)
> {
> - static_key_slow_inc_cpuslocked(&__cfs_bandwidth_used);
> + static_branch_inc_cpuslocked(&__cfs_bandwidth_used);
> }
>
> void cfs_bandwidth_usage_dec(void)
> {
> - static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used);
> + static_branch_dec_cpuslocked(&__cfs_bandwidth_used);
> }
> #else /* !CONFIG_JUMP_LABEL: */
> static bool cfs_bandwidth_used(void)