Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5737368rdb; Sun, 17 Sep 2023 09:53:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVHUtMzwzBhpPB4gdKcmJJV7KLJj/D5CqGM+cOSUc6Uo+Bqqu8z8LOZbCHEPd4XM8DveCY X-Received: by 2002:a05:6808:6:b0:3a7:6d64:aa68 with SMTP id u6-20020a056808000600b003a76d64aa68mr8621415oic.18.1694969607683; Sun, 17 Sep 2023 09:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694969607; cv=none; d=google.com; s=arc-20160816; b=chsCOQ4BzGH7fjLEDZosyx9wao3Q6iZC3OSMEItxhorZWZhYqDJTWjhZ19C8a3ZeTg 0YgSTIz/yz2jueZTsKoN6TfN36t7nvVZ8DiSfF94LjsrEbmOY4A2N9gYcR3sRet/VEuS NOEiULkwlCNvmi0okkBTs8PcO6kMvQBTfuTVOUfWNJ9RG7aeD9Md5sXUA1knpU918UHz zZ+/ZP0ES/89k8Jwf8RZ1t2y8lIy1Wy+vaRAko+ZLjyz7o9ycio1qRRlAsu4yL+1M18u hUidaeOEJFqnfVrJimUVPWCGugIbM9ZOLQNhfkqyquIOhCsCohjoLFFuQ1OHGv49RPrL l3og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=rgW2MUYlHHfdCZ+QdWezRlOQ9jHuf7PY43yzWv+wfSM=; fh=63c0tIZsdXzb7lkMkhdcm7rLvhR8FffJ1v/KZpNz/jQ=; b=0Rjj474FK1Xa/DlkbSm8BjFM2PCtLCs9JjtbrNRYChaRQBjFNJT0Kd/4AjnTDE5Rn9 hmYet4he1A+vpTkOZdD25eUsETay6ni2P/sv5R/CNZvQ0IlHagckItwjonP0PY+mz+ZX FTpybUbmLY3/owSe6lHjVD6sZOO/bkaSSiVDHhIhG+bKBnxp+yP+MF0g734VTcZCxvv4 UcKT3RfOySAFy0j3yLXCtP7NmG9E8zdtFRZQEB1GkgirDU6a7yOr4rAQ5QcU+0Gd9X6P Duvhf/dLtDYnUYb0ZUbu9zhFTQf7YxNZYJEW59eRfkI9j+qixJH+7oDAZFevHhDKlhcp /orA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GPuNjIfk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s67-20020a632c46000000b00577690ac177si6435944pgs.78.2023.09.17.09.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 09:53:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GPuNjIfk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EDB44801CDB1; Sun, 17 Sep 2023 09:53:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236560AbjIQQww (ORCPT + 99 others); Sun, 17 Sep 2023 12:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237055AbjIQQwq (ORCPT ); Sun, 17 Sep 2023 12:52:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943C4188 for ; Sun, 17 Sep 2023 09:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694969509; 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=rgW2MUYlHHfdCZ+QdWezRlOQ9jHuf7PY43yzWv+wfSM=; b=GPuNjIfkACW5iU9yVzT97Wh0CvNk3ZW/aG6b3KQjaLMvGXXH69zf1MIKkKZBTA8sPWLH7r ZEWe4A53zkipDSkVFtbA6anraOSwoujcsMGB1BAhC/Gt9FnFJPTJfu5Jk5FGW9k4YNp1ZV n6D1o7jkhvJWZGZsVcQSwm8Iv7NSgy4= 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-118-7D-EcRCMNxOI8vbd2BqiLg-1; Sun, 17 Sep 2023 12:51:44 -0400 X-MC-Unique: 7D-EcRCMNxOI8vbd2BqiLg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F192945926; Sun, 17 Sep 2023 16:51:44 +0000 (UTC) Received: from [10.22.8.73] (unknown [10.22.8.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C64110F1BE7; Sun, 17 Sep 2023 16:51:43 +0000 (UTC) Message-ID: <5e513c72-7198-a55e-6e2b-a811d5529284@redhat.com> Date: Sun, 17 Sep 2023 12:51:43 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH 1/1] cgroup/cpuset: Rebuild sched domains if isolated partition changed Content-Language: en-US To: Pierre Gondois , linux-kernel@vger.kernel.org Cc: rui.zhang@intel.com, aaron.lu@intel.com, Zefan Li , Tejun Heo , Johannes Weiner , cgroups@vger.kernel.org References: <20230915154505.363754-1-pierre.gondois@arm.com> <20230915154505.363754-2-pierre.gondois@arm.com> From: Waiman Long In-Reply-To: <20230915154505.363754-2-pierre.gondois@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 17 Sep 2023 09:53:24 -0700 (PDT) On 9/15/23 11:45, Pierre Gondois wrote: > When an isolated parition is created, the sched domains (sds) are > rebuilt and the sds of the isolated CPUs are detached. This only > happens at the creation of the isolated parition. Updating > the cpuset of the partition doesn't rebuild the sds: > > To reproduce: > # ls /sys/kernel/debug/sched/domains/cpu0/ > domain0 > # ls /sys/kernel/debug/sched/domains/cpu1/ > domain0 > # > # mkdir cgroup > # mount -t cgroup2 none cgroup/ > # mkdir cgroup/A1/ > # echo "+cpuset" > cgroup/cgroup.subtree_control > # echo 0-3 > cgroup/A1/cpuset.cpus > # echo isolated > cgroup/A1/cpuset.cpus.partition > # > # ls /sys/kernel/debug/sched/domains/cpu0/ > # ls /sys/kernel/debug/sched/domains/cpu1/ > # > # echo 0 > cgroup/A1/cpuset.cpus > # ls /sys/kernel/debug/sched/domains/cpu0/ > # ls /sys/kernel/debug/sched/domains/cpu1/ > # > > Here CPU1 should have a sched domain re-attached. > > Signed-off-by: Pierre Gondois > --- > kernel/cgroup/cpuset.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 58e6f18f01c1..e3eb27ff9b68 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -1680,11 +1680,15 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp, > * empty cpuset is changed, we need to rebuild sched domains. > * On default hierarchy, the cpuset needs to be a partition > * root as well. > + * Also rebuild sched domains if the cpuset of an isolated > + * partition changed. > */ > - if (!cpumask_empty(cp->cpus_allowed) && > - is_sched_load_balance(cp) && > - (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) || > - is_partition_valid(cp))) > + if ((!cpumask_empty(cp->cpus_allowed) && > + is_sched_load_balance(cp) && > + (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) || > + is_partition_valid(cp))) || > + (cp->partition_root_state == PRS_ISOLATED || > + cp->partition_root_state == PRS_INVALID_ISOLATED)) > need_rebuild_sched_domains = true; > > rcu_read_lock(); Thanks for spotting the problem and sending out a patch to fix it. However, it should be done in the update_cpumask(). The sched_domain rebuild in update_cpumasks_hier() is supposed to be used for impacted descendant cpusets lower down in the hierarchy. Anyway, I believe this problem should have been fixed in commit a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") recently merged into the v6.6 kernel. Would you mind testing the latest upstream kernel to see if this problem is gone or not? Thanks, Longman