Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2199227rwl; Thu, 6 Apr 2023 07:09:49 -0700 (PDT) X-Google-Smtp-Source: AKy350a59oqJmr1LmdWJifw4hrxKrgR/HYVY4Vzw1SuQa1ratXpPcyg/zd6jtls4jqY/U9kNP/mM X-Received: by 2002:a17:906:b317:b0:93a:6e9c:262e with SMTP id n23-20020a170906b31700b0093a6e9c262emr7070343ejz.23.1680790188816; Thu, 06 Apr 2023 07:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680790188; cv=none; d=google.com; s=arc-20160816; b=w0tmq5HBEo3ELzMIRLfhRL0EA5PVBEO7alJhuzOBq0m4h/eM4cYvViFob3RggcdJWS JBwt5WmR6Jw2muB6rTUH1+qmDEt9c2kcD4bsfvq0Ycd+b6ZP1uSzOn2xlJe+nXg7Y1Qo y4gcZBFofievjVeKLJmmGdNglNothNAGJK1sdFMobcSDPvBFfrqBb5+g7kLSrn97hKns JSRLSXimqzG9nJDWMqWhmnidDjTSBkZE2smaTO4U1FVR7L3v7R0FUt7Pgt52uhiXZJhr 0XiF2l2x7zEsA2FY1LJdhUr45HZKsB374FKUplXgkiHJhP0KyN6K6VYP7fO6P6Cfb5Wh TmGQ== 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=Y3klBPS5f5pxKDuGhP3oupQdkk1kbCRTfG9zpyKuKHs=; b=lm/j+RtqIGEFo92UMdztbGReZ+vqXdF7ufmfdUaDVSqWwm1cJrv6B/fA22kWvtlng6 09fDIrhT7qtuBvgAcprPJJAKGLkcpv7MHJmgGfjocwlTA6tR6pthQqB/NtmdpOb378K5 /tH0l5hNrXgvRJe0DSzy9JcX6cximy9DkL748Pi3DNUI06YFeAqEa/+wolkakPyJ8SLQ i0eqqxtNvAiep//OI8xyTH8Dl5aABXkJ/hw4/fvDhZdXnRYxPGD67zZYBDjpQBN3nqdr zboV+BM1jvmt2zBgnajLVL9kQYtqqYOPhUlmFy9mDW/roy9BUiHc6NLZ0K5dBErYwJ6L qSeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NtG8OjGy; 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 qb13-20020a1709077e8d00b00945201cecbdsi1465842ejc.996.2023.04.06.07.09.13; Thu, 06 Apr 2023 07:09:48 -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=NtG8OjGy; 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 S236859AbjDFOF7 (ORCPT + 99 others); Thu, 6 Apr 2023 10:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238983AbjDFOFu (ORCPT ); Thu, 6 Apr 2023 10:05:50 -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 ED5747EEF for ; Thu, 6 Apr 2023 07:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680789870; 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=Y3klBPS5f5pxKDuGhP3oupQdkk1kbCRTfG9zpyKuKHs=; b=NtG8OjGyFZtYmrrMxUXT6EhWev0Pmoj7LSVSYEXZdZETv+sDJOKI2dVY4iju4sCDpRj2YW iPfbQFVU36Valf1m/gaRTBQriGnODnhOiqmKv3pn2PuhBfVCYgmBYWUhEg3IDX6BTbI5rJ X8FEn5hdfO4/txRH7kr60dz4iSLYgaw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-544-Q4M4DRTyM-eKVkYZSsV3yQ-1; Thu, 06 Apr 2023 10:04:20 -0400 X-MC-Unique: Q4M4DRTyM-eKVkYZSsV3yQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C1FB38601B0; Thu, 6 Apr 2023 14:04:20 +0000 (UTC) Received: from llong.com (unknown [10.22.9.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE66840C6EC4; Thu, 6 Apr 2023 14:04: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?= , gscrivan@redhat.com, Waiman Long Subject: [PATCH v3 4/4] cgroup/cpuset: Make cpuset_attach_task() skip subpartitions CPUs for top_cpuset Date: Thu, 6 Apr 2023 10:04:04 -0400 Message-Id: <20230406140404.2718574-5-longman@redhat.com> In-Reply-To: <20230406140404.2718574-1-longman@redhat.com> References: <20230406140404.2718574-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.2 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 a331e11e3d20..8fd90f7bdeb0 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