Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5528058rwl; Tue, 11 Apr 2023 06:46:43 -0700 (PDT) X-Google-Smtp-Source: AKy350ZEtbbMMjonyfElewi/PYEahpfU+1DFqBqHmfxeLt29gpkXj9gXrt6JVDjY0Qn+KnzWBMnV X-Received: by 2002:a17:907:1ca3:b0:92e:eecf:b742 with SMTP id nb35-20020a1709071ca300b0092eeecfb742mr13126073ejc.2.1681220802797; Tue, 11 Apr 2023 06:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681220802; cv=none; d=google.com; s=arc-20160816; b=OB+iGcuL8we8tIz1eIGNobJuhb5AOphpaTwlm4E6lHBiKSrTmGVOTs8J6tmui8TWES dGCNDrqlxDY+Th9ywuaeJFKJi0oJpxbvErVY87a20J0DF9yyeI8+hyf4oqiuUdTtBXgp TJNm/lpSUYTiQACovKWX60PAtGktL1D/RIllIm7uDKQdnqH9UzTQmT0mWten2H7Qn9cq 6jTec+xgsEBgV7qLO/+Kb+He4hjcrX++2+G3k+B+X2VSM8dR/J8oOEe8AMJrFU8L4bvu zxcwSO1JD7JyH+09zFQ7vqHtBev7KQsZHm+5Q6NcmZyX77egK9NjMgUPsSZm+Vs0E+EB Ejfw== 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=kzazreGEyW5lPkWO+0aC7Q/lAqe7xC+WA1Ec8aj/SsU=; b=gisXRHZVW2+RBoYssvSfb/WapTg+etVZXEUrEAxXadMGuJEFOcXJAURcfrSyHPSsm/ JhsVTfJ38ewkefBTcz9DSCF6gsNrRasCr+ytMVceqriHfDHWMpEo9CqgitRqblm1LAoP W8g1qDtGPVAEnWpfdzTmvikG2WzBNximyZspVO2DfG7ZcB+KTjluBwrL17FqidDHbM8/ 2uQo6NEoF9j4NkQR/2nkAb1qhmtPDe914zGq38ag67xuAYiE80nqhLozJN6beE+2QYyh LMm2fxXz/sr8g0rRmKVx/TaWAjIQKAnwVTp5mecmlo/oDN04z8HXUu2HhQSkLIo8G+bz 4tHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G3SKqpzR; 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 e7-20020a50ec87000000b00504a2ccfa73si4398279edr.80.2023.04.11.06.45.02; Tue, 11 Apr 2023 06:46:42 -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=G3SKqpzR; 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 S230291AbjDKNiB (ORCPT + 99 others); Tue, 11 Apr 2023 09:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbjDKNhx (ORCPT ); Tue, 11 Apr 2023 09:37:53 -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 55F853AB6 for ; Tue, 11 Apr 2023 06:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681220184; 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=kzazreGEyW5lPkWO+0aC7Q/lAqe7xC+WA1Ec8aj/SsU=; b=G3SKqpzRdGVqpUObO2GXOzUZQkYckK2bjZlt0fOz/Xbh7F1gLD0VGXaeqPh16U1VX/VSPB EyqKYFU6QTi4HL5EINo5UCK2TN3qvJVw5lK6Ec0saJFsURiBdUC76WXzYvEAL0F5ajaGTr BikaHc875+XSsEHr6DmrF3dNnO5Ugnc= 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-631-O11OGfWNMfio1MX3RF7cGg-1; Tue, 11 Apr 2023 09:36:21 -0400 X-MC-Unique: O11OGfWNMfio1MX3RF7cGg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F048F855432; Tue, 11 Apr 2023 13:36:19 +0000 (UTC) Received: from llong.com (unknown [10.22.33.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8256947CDC; Tue, 11 Apr 2023 13:36:19 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Christian Brauner 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 v4 4/5] cgroup/cpuset: Make cpuset_attach_task() skip subpartitions CPUs for top_cpuset Date: Tue, 11 Apr 2023 09:36:00 -0400 Message-Id: <20230411133601.2969636-5-longman@redhat.com> In-Reply-To: <20230411133601.2969636-1-longman@redhat.com> References: <20230411133601.2969636-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 It is found that attaching a task to the top_cpuset does not currently ignore CPUs allocated to subpartitions in cpuset_attach_task(). So the code is changed to fix that. Signed-off-by: Waiman Long Reviewed-by: Michal Koutný --- kernel/cgroup/cpuset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 132cdae4f03c..e4ca2dd2b764 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2540,7 +2540,8 @@ static void cpuset_attach_task(struct cpuset *cs, struct task_struct *task) if (cs != &top_cpuset) guarantee_online_cpus(task, cpus_attach); else - cpumask_copy(cpus_attach, task_cpu_possible_mask(task)); + cpumask_andnot(cpus_attach, task_cpu_possible_mask(task), + cs->subparts_cpus); /* * can_attach beforehand should guarantee that this doesn't * fail. TODO: have a better way to handle failure here -- 2.31.1