Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6285314rwl; Tue, 4 Apr 2023 10:12:39 -0700 (PDT) X-Google-Smtp-Source: AKy350aQTDJGoMg2eCnxbttUMltgl1EChkca6P1NXPr8GGB0n9vwIzajOHGBPJfg9N9uL7EEs8p8 X-Received: by 2002:a17:906:af73:b0:930:e9ee:c474 with SMTP id os19-20020a170906af7300b00930e9eec474mr219212ejb.54.1680628359406; Tue, 04 Apr 2023 10:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680628359; cv=none; d=google.com; s=arc-20160816; b=Lb6kyP07RsqMCkSUpZUP+yGpexkIRI9ssFaqqoNAqQA3jp1CcZH3wxthjmatexpNlg kmmVOrFdnw4+/TvNd8RH9hh6Q/r3DukH1o/00yJiadFfPq3EZG6qw5jQaJ5Ro/E3j0eK iKtbedaB/wCqn9OUNrnhTGQ78agD/wafxSvKqXsoTWIXm+fGvOgckZaumryoSBs8Ox2R a0DHYiRwzIfj7aijkR35Rl2zxUao6PxNf/hVj23pdot8jwix20N1EqO+/iemrf6IM1GL QAhthWfZl8913lDtLufKLMbIYkgtBbvHOFx9cKf8FKn+rhdkzJDNODi2IUmYeiIi6Q2l y/4Q== 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=kw9bOB+w9RaCMC/2ecbxmrC9gMAMXWH6G3Pa3TXU2lQ=; b=UL7jXJVqC57jDhVUrUkcUH929NZzsXZ0jqUShQNQwte4vC7uxgzBHiNrl3kDKMTYMa wqdgkgmSCSxttwh3VakXdbxGNEivgKg+tYXpF/EU3d1LA6rLFQb52Vz1iFFxEj6WMRcU Kr9lNQ/d7FXHMGmwzn0BXE+3azfavrLkX8UmtXuwNYcdoZfp2Zfablwxm910VdGUaVFv twrR8FtDKgsKUC/2Fk+y3wp9jasW0sj5wtUWRgqiz7dWHTgMHJ4p/aIIBT+JRe21S2BQ A5UWXUhdd6+jQjMPp/jgG8H62MzXq643gLtGJNkOriEuzIUUrGHWjeT8mFbooW8Jbuz5 bUSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R6vihc0q; 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 y23-20020a50e617000000b0050050f6e7a6si2937606edm.602.2023.04.04.10.12.14; Tue, 04 Apr 2023 10:12:39 -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=R6vihc0q; 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 S235644AbjDDRHx (ORCPT + 99 others); Tue, 4 Apr 2023 13:07:53 -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: 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 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, 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