public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Christian Brauner <brauner@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Giuseppe Scrivano" <gscrivan@redhat.com>,
	"Waiman Long" <longman@redhat.com>
Subject: [PATCH v8 1/7] cgroup/cpuset: Fix load balance state in update_partition_sd_lb()
Date: Tue,  5 Sep 2023 09:32:37 -0400	[thread overview]
Message-ID: <20230905133243.91107-2-longman@redhat.com> (raw)
In-Reply-To: <20230905133243.91107-1-longman@redhat.com>

Commit a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE
& CS_SCHED_LOAD_BALANCE handling") adds a new helper function
update_partition_sd_lb() to update the load balance state of the
cpuset. However the new load balance is determined by just looking at
whether the cpuset is a valid isolated partition root or not.  That is
not enough if the cpuset is not a valid partition root but its parent
is in the isolated state (load balance off). Update the function to
set the new state to be the same as its parent in this case like what
has been done in commit c8c926200c55 ("cgroup/cpuset: Inherit parent's
load balance state in v2").

Fixes: a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling")
Signed-off-by: Waiman Long <longman@redhat.com>
---
 kernel/cgroup/cpuset.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 58ec88efa4f8..4749e0c86c62 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1304,13 +1304,23 @@ static int update_partition_exclusive(struct cpuset *cs, int new_prs)
  *
  * Changing load balance flag will automatically call
  * rebuild_sched_domains_locked().
+ * This function is for cgroup v2 only.
  */
 static void update_partition_sd_lb(struct cpuset *cs, int old_prs)
 {
 	int new_prs = cs->partition_root_state;
-	bool new_lb = (new_prs != PRS_ISOLATED);
 	bool rebuild_domains = (new_prs > 0) || (old_prs > 0);
+	bool new_lb;
 
+	/*
+	 * If cs is not a valid partition root, the load balance state
+	 * will follow its parent.
+	 */
+	if (new_prs > 0) {
+		new_lb = (new_prs != PRS_ISOLATED);
+	} else {
+		new_lb = is_sched_load_balance(parent_cs(cs));
+	}
 	if (new_lb != !!is_sched_load_balance(cs)) {
 		rebuild_domains = true;
 		if (new_lb)
-- 
2.31.1


  reply	other threads:[~2023-09-05 16:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 13:32 [PATCH v8 0/7] cgroup/cpuset: Support remote partitions Waiman Long
2023-09-05 13:32 ` Waiman Long [this message]
2023-09-05 13:32 ` [PATCH v8 2/7] cgroup/cpuset: Add cpuset.cpus.exclusive.effective for v2 Waiman Long
2023-09-05 13:32 ` [PATCH v8 3/7] cgroup/cpuset: Add cpuset.cpus.exclusive " Waiman Long
2023-09-05 13:32 ` [PATCH v8 4/7] cgroup/cpuset: Introduce remote partition Waiman Long
2023-09-05 13:32 ` [PATCH v8 5/7] cgroup/cpuset: Check partition conflict with housekeeping setup Waiman Long
2023-09-05 13:32 ` [PATCH v8 6/7] cgroup/cpuset: Documentation update for partition Waiman Long
2023-09-05 13:32 ` [PATCH v8 7/7] cgroup/cpuset: Extend test_cpuset_prs.sh to test remote partition Waiman Long
2023-09-18 20:33 ` [PATCH v8 0/7] cgroup/cpuset: Support remote partitions Tejun Heo
2023-10-13 15:50 ` Michal Koutný
2023-10-13 16:03   ` Waiman Long
2023-10-24 16:13     ` Michal Koutný
2023-11-01 18:14       ` 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=20230905133243.91107-2-longman@redhat.com \
    --to=longman@redhat.com \
    --cc=brauner@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=gscrivan@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mkoutny@suse.com \
    --cc=shuah@kernel.org \
    --cc=tj@kernel.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