linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] sched: Dec __cfs_bandwith_used in destroy_cfs_bandwidth()
@ 2021-07-06  8:38 Zhang Qiao
  2021-07-12 16:26 ` Daniel Jordan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zhang Qiao @ 2021-07-06  8:38 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot; +Cc: pjt, linux-kernel

__cfs_bandwith_uesd 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.
Therefore, when removing a cfs bandwidth group, we decrease
__cfs_bandwith_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@huawei.com>
---
 kernel/sched/fair.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 103e31e53e2b..857e8908b7f7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5344,6 +5344,9 @@ static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
 	if (!cfs_b->throttled_cfs_rq.next)
 		return;
 
+	if (cfs_b->quota != RUNTIME_INF)
+		cfs_bandwidth_usage_dec();
+
 	hrtimer_cancel(&cfs_b->period_timer);
 	hrtimer_cancel(&cfs_b->slack_timer);
 }
-- 
2.18.0.huawei.25


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-31 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06  8:38 [PATCH -next] sched: Dec __cfs_bandwith_used in destroy_cfs_bandwidth() Zhang Qiao
2021-07-12 16:26 ` Daniel Jordan
2021-07-15 11:24 ` [PATCH -next v2] sched: Dec cfs_bandwith_used " Zhang Qiao
2021-07-15 20:28   ` Daniel Jordan
2021-07-16  2:27 ` [PATCH -next v3] sched: Dec cfs_bandwidth_used " Zhang Qiao
2021-07-16 13:53   ` Daniel Jordan
2021-08-31 11:17   ` Zhang Qiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).