Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp440569rwr; Wed, 3 May 2023 00:28:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/vnic4aVUzBu4mn9gkT8RdxNxkkl63ndvKz1mt17SYfdOE02X/bB2J3j4Ujg91vSFVveT X-Received: by 2002:a17:902:7d93:b0:1a9:79e7:2ba with SMTP id a19-20020a1709027d9300b001a979e702bamr1229636plm.23.1683098937487; Wed, 03 May 2023 00:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683098937; cv=none; d=google.com; s=arc-20160816; b=NjVVggLZ3gfxApOslC+gnU5l71oyImeLzMnnv6Dhsa9tvLGhUEIjpLIJdA1a5IuKZ6 P3HBLXHkjB724FJDC6nleUnKwm02K7rvbl996rEPsvAn6AmOW7nLH+J/FmSrgZd5YD15 /7edMHh0khUxZ7sV1Dd6YSQlt61WDZASieU1Pf6bbCQn06RLLtoTnjbPCuufvKNNdvCV 0B1MBVrRX1oP1HoMwt9KlzXodbVAb1umDRuU3v2w+8X1gW7A02zw2jiuhvcj4VuIskR7 U4zYO6/t6DkGZ0NLTFzr5UDZjv2hlxU0/Vb+Gkh1iF2R7kNw408FbHfw0dORMa3VKNL1 T8vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lqYMRmafBeRnD0m4iF8Fupf42DdArIxTTZivyAku9O8=; b=UMATIPso0zT8RUvwdSASC3QNlofyrl3xyNKgNidlR1rGQfwk6fAniO5Znf5v5i3zxy rDmgVV3h2hg7/1P+3C6IC/F94xCnow01z7S2sNFMW8xkYBiJ4f/Equ3hBA44nuQiAqdo dUwSkO/gxheW+E666RweaBgzOPJYgRwZT2OOIrNguhI5ZvrJKnX/68pPUiNxwep65BhD paysDjfynXLWPa1Q8UQzNoyBkJyT5YL39RhqSvdbOaADSQdN1urlhT3PiTOXSPG1LL0y lxTlcyp8EO+xC/YC1nhCmPpGk2J6qIMXpIdDE0m4dI+8hxnsbb7LsP+dNBeFvFeBotEu Md6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CJ7KQtEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ix22-20020a170902f81600b001a93c1d66e0si2633572plb.269.2023.05.03.00.28.43; Wed, 03 May 2023 00:28:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CJ7KQtEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbjECHYH (ORCPT + 99 others); Wed, 3 May 2023 03:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjECHX4 (ORCPT ); Wed, 3 May 2023 03:23:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B98B840FD for ; Wed, 3 May 2023 00:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683098591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lqYMRmafBeRnD0m4iF8Fupf42DdArIxTTZivyAku9O8=; b=CJ7KQtEzF6hRKiZKQggPGeQyCMAuZbmOzYe2XcBodfsWuSpVodSjM+Va2AcwHptaDrLUiR AMEPFCDjn6+/NlFdEqdxK2eFYAms+qMdfZiThAjnNwhs8SWslnX5O9Mw/iUk+IJiy9BpX2 0T3fh+u3Po3BVxmHSDvBHIxfwigFtMk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-EfQFO7JqNOq1LkQraJqDew-1; Wed, 03 May 2023 03:23:10 -0400 X-MC-Unique: EfQFO7JqNOq1LkQraJqDew-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f3fe24912cso1278685e9.0 for ; Wed, 03 May 2023 00:23:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683098589; x=1685690589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lqYMRmafBeRnD0m4iF8Fupf42DdArIxTTZivyAku9O8=; b=mD+Ayy/L2oQmqmIzZoHfYNNNpp4vAbpupDOy+3S4zGKAntlcCQ6Jmvr89V+GqWC1HB aob/VZ1KuS9cPqZMAEvCx9Ks+XaMWt5gEALHQvtGmbepARnowJK0bzevO/CLqohFBMFy MsdqWfJQAl3r/GJgHxUoPAoXWIsNW+KmZIrB9ZLslZlAnEtUbWLO2JLKLkEajJ+gMKHh 0eLBEXDyKbkuYnW0+DYZpqlsE9/wxtlCVxCBoZnuOr1cGXgS7lkWFe44gFANbkwZppZ3 QdwAwO8NaUwPnBGqfPuQ1OVa+jAg3MhpU3Z6stx8qyPQ5oE6yyO6wdb0TyBEyxDsDlgC 1vYw== X-Gm-Message-State: AC+VfDwhzSUZhPPhlU8JnMFcYp3+/xJAAriOuxrWpk5/qhvX2wCM59iR d1dwSiRDrDIWtGs/w9AR/giQ7ePGoCV/hZEqNnC6O9NCRGyo6C2x1zR2gs7kq5PhJzWtDjimFSi zWsK7DCjsFMXq2LabPqeU0ffi X-Received: by 2002:a05:600c:2212:b0:3f1:73c1:d1ad with SMTP id z18-20020a05600c221200b003f173c1d1admr13737472wml.35.1683098589220; Wed, 03 May 2023 00:23:09 -0700 (PDT) X-Received: by 2002:a05:600c:2212:b0:3f1:73c1:d1ad with SMTP id z18-20020a05600c221200b003f173c1d1admr13737445wml.35.1683098588945; Wed, 03 May 2023 00:23:08 -0700 (PDT) Received: from localhost.localdomain.com ([2a02:b127:8011:7489:32ac:78e2:be8c:a5fb]) by smtp.gmail.com with ESMTPSA id k1-20020a7bc301000000b003eddc6aa5fasm947259wmj.39.2023.05.03.00.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 May 2023 00:23:08 -0700 (PDT) From: Juri Lelli To: Peter Zijlstra , Ingo Molnar , Qais Yousef , Waiman Long , Tejun Heo , Zefan Li , Johannes Weiner , Hao Luo Cc: Dietmar Eggemann , Steven Rostedt , linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, cgroups@vger.kernel.org, Vincent Guittot , Wei Wang , Rick Yiu , Quentin Perret , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sudeep Holla , Juri Lelli Subject: [PATCH v2 4/6] cgroup/cpuset: Iterate only if DEADLINE tasks are present Date: Wed, 3 May 2023 09:22:26 +0200 Message-Id: <20230503072228.115707-5-juri.lelli@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230503072228.115707-1-juri.lelli@redhat.com> References: <20230503072228.115707-1-juri.lelli@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Link: https://lore.kernel.org/lkml/20230206221428.2125324-1-qyousef@layalina.io/ Signed-off-by: Juri Lelli --- kernel/cgroup/cpuset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index b9f4d5602517..6587df42cb61 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1090,6 +1090,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.40.1