Skip to content
Commit 4bc45824 authored by Xuewen Yan's avatar Xuewen Yan Committed by Ingo Molnar
Browse files

sched/uclamp: Optimize sched_uclamp_used static key enabling



Repeat calls of static_branch_enable() to an already enabled
static key introduce overhead, because it calls cpus_read_lock().

Users may frequently set the uclamp value of tasks, triggering
the repeat enabling of the sched_uclamp_used static key.

Optimize this and avoid repeat calls to static_branch_enable()
by checking whether it's enabled already.

[ mingo: Rewrote the changelog for legibility ]

Signed-off-by: default avatarXuewen Yan <xuewen.yan@unisoc.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Reviewed-by: Christian Loehle's avatarChristian Loehle <christian.loehle@arm.com>
Reviewed-by: Vincent Guittot's avatarVincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20250219093747.2612-2-xuewen.yan@unisoc.com
parent 5fca5a4c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment