Re: [PATCH v2] sched: Convert last bits of deprecated static key usage

From: Valentin Schneider

Date: Tue Oct 06 2026 - 06:50:34 EST


On 03/09/26 11:57, Hongyan Xia wrote:
> From: Hongyan Xia <hongyan.xia@xxxxxxxxxxxxx>
>
> Raw static keys have no type information and do not prevent mis-matches
> (like static_key_false() on a default TRUE key). The helper names
> static_key_{true/false}() are also confusing, hence the deprecation.
>
> We have already converted other sites in previous patches. Convert the
> last sites of deprecated static key APIs. After this fix, scheduler code
> has zero deprecated static key APIs now.
>
> sk_dynamic_* uses static_key_{enable/disable}(), which aren't really
> deprecated, but take the opportunity to move to the new static_branch_*
> APIs to be consistent.
>
> No functional change.
>
> Signed-off-by: Hongyan Xia <hongyan.xia@xxxxxxxxxxxxx>

Some comprehension/changelog explanation nit below, otherwise:

Reviewed-by: Valentin Schneider <vschneid@xxxxxxxxxx>

> @@ -6575,21 +6575,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);
> }

Usual likely/unlikely/true/false static key confusion for me here;

The previous definition was pretty much
= STATIC_KEY_INIT_FALSE
due to static storage initialization.

And then for the static_key_*() naming, false == unlikely.

Because it's all #define magic I assume the compilation delta will be zero,
but I can't be bothered given I'm on a laptop running power saver mode.