Commit 4705be3f authored by Juri Lelli's avatar Juri Lelli Committed by sanglipeng
Browse files

cgroup/cpuset: Iterate only if DEADLINE tasks are present

stable inclusion
from stable-v5.10.193
commit c9546921a4b97813254c74ba3d1870f53f02e2ad
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9399M

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c9546921a4b97813254c74ba3d1870f53f02e2ad



--------------------------------

commit c0f78fd5 upstream.

update_tasks_root_domain currently iterates over all tasks even if no
DEADLINE task is present on the cpuset/root domain for which bandwidth
accounting is being rebuilt. This has been reported to introduce 10+ ms
delays on suspend-resume operations.

Skip the costly iteration for cpusets that don't contain DEADLINE tasks.

Reported-by: default avatarQais Yousef (Google) <qyousef@layalina.io>
Link: https://lore.kernel.org/lkml/20230206221428.2125324-1-qyousef@layalina.io/


Signed-off-by: default avatarJuri Lelli <juri.lelli@redhat.com>
Reviewed-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarQais Yousef (Google) <qyousef@layalina.io>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent b266165b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1045,6 +1045,9 @@ static void dl_update_tasks_root_domain(struct cpuset *cs)
	struct css_task_iter it;
	struct task_struct *task;

	if (cs->nr_deadline_tasks == 0)
		return;

	css_task_iter_start(&cs->css, 0, &it);

	while ((task = css_task_iter_next(&it)))