From nobody Wed Dec 17 01:44:30 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8571CC83F3E for ; Tue, 5 Sep 2023 16:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245408AbjIEQkr (ORCPT ); Tue, 5 Sep 2023 12:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354680AbjIENdi (ORCPT ); Tue, 5 Sep 2023 09:33:38 -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 CB8AD12A for ; Tue, 5 Sep 2023 06:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693920773; 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=SsMuS7PTbmTmLZ/65tzTFutVzo4Sb2uYSpo6j3AWtxQ=; b=FGIkKDgYLWI2aRaLtErTdFV8d3KzQz9HNS0IiWiJhM3hm2o9pu5wSiWjty4kJv9XXE9kAa MaHtBLkWzA8J9KiBu9QNGXsg5WqqHsuC2TuSYU2KU8qVH+Xe2cBvDsNM4ZogeSAZ4qS6I+ suX1eS0Sge9dTSHLcIUX7VY2BWlkpoQ= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-Uqy4g4SXOb6yp13Uf1nn_g-1; Tue, 05 Sep 2023 09:32:52 -0400 X-MC-Unique: Uqy4g4SXOb6yp13Uf1nn_g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F7BF1C29799; Tue, 5 Sep 2023 13:32:51 +0000 (UTC) Received: from llong.com (unknown [10.22.9.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4BDB202869C; Tue, 5 Sep 2023 13:32:50 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Christian Brauner , Jonathan Corbet , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Juri Lelli , Dietmar Eggemann , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Giuseppe Scrivano , Waiman Long 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 Message-Id: <20230905133243.91107-2-longman@redhat.com> In-Reply-To: <20230905133243.91107-1-longman@redhat.com> References: <20230905133243.91107-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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_SCHE= D_LOAD_BALANCE handling") Signed-off-by: Waiman Long --- 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 =3D cs->partition_root_state; - bool new_lb =3D (new_prs !=3D PRS_ISOLATED); bool rebuild_domains =3D (new_prs > 0) || (old_prs > 0); + bool new_lb; =20 + /* + * If cs is not a valid partition root, the load balance state + * will follow its parent. + */ + if (new_prs > 0) { + new_lb =3D (new_prs !=3D PRS_ISOLATED); + } else { + new_lb =3D is_sched_load_balance(parent_cs(cs)); + } if (new_lb !=3D !!is_sched_load_balance(cs)) { rebuild_domains =3D true; if (new_lb) --=20 2.31.1