public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Juri Lelli <juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Vincent Guittot
	<vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Dietmar Eggemann <dietmar.eggemann-5wv7dgnIgG8@public.gmane.org>,
	Steven Rostedt <rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>,
	Ben Segall <bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Mel Gorman <mgorman-l3A5Bk7waGM@public.gmane.org>,
	Daniel Bristot de Oliveira
	<bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Valentin Schneider
	<vschneid-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 2/2] cgroup: Skip subtree root in cgroup_update_dfl_csses()
Date: Wed, 27 Jul 2022 20:58:15 -0400	[thread overview]
Message-ID: <20220728005815.1715522-2-longman@redhat.com> (raw)
In-Reply-To: <20220728005815.1715522-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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 <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 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


  parent reply	other threads:[~2022-07-28  0:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  0:58 [PATCH 1/2] cgroup/cpuset: Keep current cpus list if cpus affinity was explicitly set Waiman Long
     [not found] ` <20220728005815.1715522-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-07-28  0:58   ` Waiman Long [this message]
     [not found]     ` <20220728005815.1715522-2-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-07-28 14:44       ` [PATCH 2/2] cgroup: Skip subtree root in cgroup_update_dfl_csses() Michal Koutný
2022-07-28 14:49         ` Waiman Long
     [not found]         ` <20220728144426.GA26631-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-07-28 17:26           ` Tejun Heo
2022-07-28 17:27       ` Tejun Heo
2022-07-28 14:44   ` [PATCH 1/2] cgroup/cpuset: Keep current cpus list if cpus affinity was explicitly set Michal Koutný
     [not found]     ` <20220728144420.GA27407-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-07-28 14:59       ` Waiman Long
     [not found]         ` <a58852b4-313a-9271-f31d-f79a91ec188b-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-07-28 15:23           ` Michal Koutný
     [not found]             ` <20220728152355.GB25894-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-07-28 15:35               ` Waiman Long
2022-07-28 16:50           ` Valentin Schneider
     [not found]             ` <xhsmhbkt9dvwm.mognet-lVOlpLwaOlUmbyhZVYo91WPO1xz+ivuR@public.gmane.org>
2022-07-28 17:42               ` Waiman Long
2022-07-28 17:23   ` Tejun Heo
2022-07-28 18:57     ` Waiman Long
     [not found]       ` <1ae1cc6c-dca9-4958-6b22-24a5777c5e8d-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-07-28 19:02         ` Tejun Heo
     [not found]           ` <YuLdX7BYGvo57LNU-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-07-28 19:21             ` Waiman Long
2022-07-28 20:44               ` Tejun Heo
2022-07-28 21:04                 ` Waiman Long
     [not found]                   ` <c470d3f7-f0f8-b8e6-4a95-7b334f0a824b-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-07-28 21:39                     ` Tejun Heo
     [not found]                       ` <YuMCB86fH2K3NcqM-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-07-29 14:15                         ` Valentin Schneider
     [not found]                           ` <xhsmhy1wcc8dq.mognet-lVOlpLwaOlUmbyhZVYo91WPO1xz+ivuR@public.gmane.org>
2022-07-29 14:50                             ` Waiman Long
     [not found]                               ` <92f68392-12d2-f64a-9bb9-1a3a15f99d02-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-07-29 18:31                                 ` Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728005815.1715522-2-longman@redhat.com \
    --to=longman-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dietmar.eggemann-5wv7dgnIgG8@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=mgorman-l3A5Bk7waGM@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=vschneid-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox