From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qais Yousef Subject: [PATCH 4/6] cgroup/cpuset: Iterate only if DEADLINE tasks are present Date: Sun, 20 Aug 2023 16:21:42 +0100 Message-ID: <20230820152144.517461-5-qyousef@layalina.io> References: <20230820152144.517461-1-qyousef@layalina.io> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20221208.gappssmtp.com; s=20221208; t=1692544913; x=1693149713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fUqk7FUCXaNGq1+LVkIB8ErOVi02xdB+eEVdpbHMXqY=; b=sNjs0cVk9RJbqqNQCkIsLz5NLY+roIQlisyg6c/kk1GcxcTT/QWfOCEd/Kb/ceP07i yPgZGj59yPt4ZhKMTU+qiEdbSiGFzG9sZQegnQXCap0oVi/bm0PSfjCIAUI1rNvEdZlm NVzsslyCSjGm0fcD823QoWLQ7+M99qs05V4u9vQCE/50oHICwrnbNK9nENcM4J2TON1X wzmB5DPWllZrMTRddGPnZGWH2XQFIwHqcdSXNWrFUxw5krZtabzWdFNIE2BoAklqixRS PeN2yDmqdrH1xBO876I3583MsQMbwp5x+Hqd1NgGoRcRHkX/kQENxeI93YqD1OX6Fiu+ VZqA== In-Reply-To: <20230820152144.517461-1-qyousef@layalina.io> List-ID: Content-Type: text/plain; charset="us-ascii" To: stable@vger.kernel.org Cc: Juri Lelli , Waiman Long , Tejun Heo , Dietmar Eggemann , Peter Zijlstra , Vincent Guittot , Ingo Molnar , Hao Luo , John Stultz , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Qais Yousef From: Juri Lelli commit c0f78fd5edcf29b2822ac165f9248a6c165e8554 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: Qais Yousef (Google) Link: https://lore.kernel.org/lkml/20230206221428.2125324-1-qyousef@layalina.io/ Signed-off-by: Juri Lelli Reviewed-by: Waiman Long Signed-off-by: Tejun Heo (cherry picked from commit c0f78fd5edcf29b2822ac165f9248a6c165e8554) Signed-off-by: Qais Yousef (Google) --- kernel/cgroup/cpuset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index fa8684c790a9..6c69e715b05a 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -937,6 +937,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))) -- 2.34.1