Re: [PATCH -next v3] sched: Dec cfs_bandwidth_used in destroy_cfs_bandwidth()

From: Daniel Jordan
Date: Fri Jul 16 2021 - 09:54:24 EST

On Fri, Jul 16, 2021 at 10:27:56AM +0800, Zhang Qiao wrote:
> cfs_bandwidth_used is a static_key to control cfs bandwidth
> feature. When adding a cfs_bandwidth group, we need increase
> the key, and decrease it when removing. But currently when we
> remove a cfs bandwidth group, we don't decrease the key and
> this switch will always be on even if there is no cfs bandwidth
> group in the system.
> Fix the problem as two steps:
> 1.Rename cfs_bandwidth_usage_{dec, inc}() to
> cfs_bandwidth_usage_{dec,inc}_cpuslocked() and its caller need to
> hold the hotplug lock.
> 2.Add cfs_bandwidth_usage_dec() and its caller don't need
> to hold the hotplug lock. And when removing a cfs bandwidth group,
> we decrease cfs_bandwidth_used by calling cfs_bandwidth_usage_dec().
> Fixes: 56f570e512ee ("sched: use jump labels to reduce overhead when bandwidth control is inactive")
> Signed-off-by: Zhang Qiao <zhangqiao22@xxxxxxxxxx>

Reviewed-by: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx>