Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp161479imn; Wed, 27 Jul 2022 18:43:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6UgyWdQic7xGvyKay+Xblbgwp0jJW6Ewkq+SUWe6k7NBVyUKjbnsk4T8V2QtL3rAfy/Ub X-Received: by 2002:a63:1f02:0:b0:41a:f9b8:b4fd with SMTP id f2-20020a631f02000000b0041af9b8b4fdmr14187023pgf.443.1658972618784; Wed, 27 Jul 2022 18:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658972618; cv=none; d=google.com; s=arc-20160816; b=qKEkPD26SaU6bRBoCRvwQT9qs72YlNkSMvpOKrOr9SNixR78rhN+Ld0LqKqzP0NeGL SUruzErh1dv3uyBE8BTXOMa1Dnrhed5ZlLZ5kuICqxZyi5oaiOYYgLxusH76rzeg1vil zCb6UASTxB9gmmyhKZK7PkvCXeR/1T1Ku0BZwvqUh/8FuGYfn9i1eVs5cY6aUy+U97UW igkWb/TPuWSQfh7XypapkOZcvbEbmm8Zk8AbgsfbveqPX8jS5d/uVY1YT+tAZK9Atp2N 06LmCY+2Aec3IAJHG2HVVRlhwOQnB38ORee8Sx5Od3d+QDfmnCXOaJCsLcDlmg06suPq E5WA== 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=gaSdAy4qMc+i3X3/uhcqoqHr76wuTtjP8hQcmc/LmaQ=; b=SLS2FEX8Tqu+PrPdZ1u2S49LuW2AiUuSkh7X82l2rLIY3HIsczsmfK1fK5wMUcFb+U 0AkfzIjQROVxJpaFnvhk2UWh2vybj8SPUQIXerP2W/1eNFc1pgCHKf6k37ZD7CGiRF7l IVZeOGmXXiNEY3Hg/PoIYfqMqbj3T9FYj9dkdxeGEEj7kDAlbQbJhjO4Ljcsg9hcIs8j ldJ/3lhJLBFOvJtTBgmGtl1swwUATl6hSNauOWIXYTrnhq4t0g4WY8XKcow4NjIa+Cnj MaS5+43rcBM0wyxtKNbsph/wvt63KwnXrswaq/qFYl2wbmLXYr1Fuc4QRMMsZZuTmPPh trqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KtdJtdgC; 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 f125-20020a623883000000b005295011e4f8si21220355pfa.228.2022.07.27.18.43.23; Wed, 27 Jul 2022 18:43:38 -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=KtdJtdgC; 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 S236816AbiG1A6s (ORCPT + 99 others); Wed, 27 Jul 2022 20:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbiG1A6p (ORCPT ); Wed, 27 Jul 2022 20:58:45 -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 ESMTP id D15F25A3E7 for ; Wed, 27 Jul 2022 17:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658969924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gaSdAy4qMc+i3X3/uhcqoqHr76wuTtjP8hQcmc/LmaQ=; b=KtdJtdgCLbgvu8+pi8mqxHne0RUi5X5FqXc88SMhd8rDaRSlGWFjC9DTmDzWcyd6uSZO+Z R6ExuHy0X11L4XKKoLaKc7tnAnJdLNUwWSMFdkee8JUEQ4btqKDTK2pu3J67obF+9Doect 2seoHnojNWpnyow9r7xb5tDGQ3nl/rg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-499-5AbWPQWLNMONX91Or2AirQ-1; Wed, 27 Jul 2022 20:58:37 -0400 X-MC-Unique: 5AbWPQWLNMONX91Or2AirQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 269DA8037AA; Thu, 28 Jul 2022 00:58:36 +0000 (UTC) Received: from llong.com (unknown [10.22.8.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BC66C15D67; Thu, 28 Jul 2022 00:58:35 +0000 (UTC) From: Waiman Long To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Tejun Heo , Zefan Li , Johannes Weiner Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH 2/2] cgroup: Skip subtree root in cgroup_update_dfl_csses() Date: Wed, 27 Jul 2022 20:58:15 -0400 Message-Id: <20220728005815.1715522-2-longman@redhat.com> In-Reply-To: <20220728005815.1715522-1-longman@redhat.com> References: <20220728005815.1715522-1-longman@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 The cgroup_update_dfl_csses() function updates css associations when a cgroup's subtree_control file is modified. Any changes made to a cgroup's subtree_control file, however, will only affect its descendants but not the cgroup itself. So there is no point in migrating csses associated with that cgroup. We can skip them instead. Signed-off-by: Waiman Long --- kernel/cgroup/cgroup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 13c8e91d7862..1151ff44d578 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2960,6 +2960,15 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp) cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) { struct cgrp_cset_link *link; + /* + * As cgroup_update_dfl_csses() is only called by + * cgroup_apply_control(). The csses associated with the + * given cgrp will not be affected by changes made to + * its subtree_control file. We can skip them. + */ + if (dsct == cgrp) + continue; + list_for_each_entry(link, &dsct->cset_links, cset_link) cgroup_migrate_add_src(link->cset, dsct, &mgctx); } -- 2.31.1