From nobody Wed Feb 11 08:11:56 2026 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 78438C6FD1D for ; Tue, 4 Apr 2023 17:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235643AbjDDRHz (ORCPT ); Tue, 4 Apr 2023 13:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235305AbjDDRHu (ORCPT ); Tue, 4 Apr 2023 13:07: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 A0F2044BB for ; Tue, 4 Apr 2023 10:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680627990; 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=kw9bOB+w9RaCMC/2ecbxmrC9gMAMXWH6G3Pa3TXU2lQ=; b=R6vihc0qA8EJY1CEKmTG67PyWH9XY5ytO2kFekQ2/XQxdDQCcAiX3sAOGtLk2msbg9PQ00 7gTrr040rNCvELVQ4jNDi9wBBh/1h3W7RDFYT7CEV0nOewJ7gyK+a+ANdQ0WQuJZxwrp95 pd8odFJf74Atl/u+6TasSaog4lvtDTU= 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-122-5HyO8yuwOo-sQk7DTiQ7Nw-1; Tue, 04 Apr 2023 13:06:26 -0400 X-MC-Unique: 5HyO8yuwOo-sQk7DTiQ7Nw-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 95CBF1C06ED5; Tue, 4 Apr 2023 17:06:18 +0000 (UTC) Received: from llong.com (unknown [10.22.32.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 231BCFD6E; Tue, 4 Apr 2023 17:06:18 +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 v2 4/4] cgroup/cpuset: Make cpuset_attach_task() skip subpartitions CPUs for top_cpuset Date: Tue, 4 Apr 2023 13:05:46 -0400 Message-Id: <20230404170546.2585050-5-longman@redhat.com> In-Reply-To: <20230404170546.2585050-1-longman@redhat.com> References: <20230404170546.2585050-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=C3=BD --- 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 db1fca5cba06..056ec7dbfa3c 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2540,7 +2540,8 @@ static void cpuset_attach_task(struct cpuset *cs, str= uct task_struct *task) if (cs !=3D &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 --=20 2.31.1