Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1191978rwl; Fri, 31 Mar 2023 07:53:38 -0700 (PDT) X-Google-Smtp-Source: AKy350a/a/OpeSCaGdZoDRM3oUmv4wA0a5GT++SYqZmtLfVnhXLa+65SrlwPZKnPkbhqVKphXhFz X-Received: by 2002:a17:90a:788f:b0:23d:2b53:1ae2 with SMTP id x15-20020a17090a788f00b0023d2b531ae2mr5642174pjk.3.1680274418325; Fri, 31 Mar 2023 07:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680274418; cv=none; d=google.com; s=arc-20160816; b=i1r9XwqOavTyglqi/yJwE2pWG794+NLt3Czq/OAzlxbO/AUdlxcu+7imImh0A+DhkB xNx7Pxwp7QSZVHmmE9VwZ3BDMd5HvzXErb/nvRM0/VSVSuCiiebyaAXGKcBTn+eydj/b jR6gGQZNaj/nRsMez7OZbD1nKtT2zDBZIDa7uXXE71PqFUNnoDbt8EDoiAFT09O0i4m2 DQqeINLSvclKFTffya9sAXBglHKk+bvZnwV8IDUSxCdRmhdHApTNsV6ryO1esnC1mNFR s52gX+VmKe0mRmSZU+J+iH5JsRz1bvvaWnPXyqxyqhv8kdVxOaawroqOPTd5aTqHMXdz amOg== 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=+9i7sLun1jgv9svlyB9jcs4mFG0+IKoU4iPpMJ0u9ZQ=; b=Dar2ek+r5MxFWOgFZGdYYU80lslQPJmxMt1OBk9hBkKpGm5Ra0qnmm3KYwSzhTYkWJ DQMC6S2JjP8u4NV6flqCs16GWZ2vWIqdW72K4l7g2vGNFfVVq/cee4jr8yT8KdGMZUZ0 OcglU8DuQMM9cFQLIkCmNPFM/eNwGmH1hYRQnF1T9KY0qAj0Kdu+IoQqTqLIwGPXmogt GTeJjlA2MMxOVdUwdDbl83fBFx9fofACIaLKmBDib+/mfASxYOXpCVuQzO3kEMeLNmj4 yyfCHVsEDAh1hq7vAiaeNKN5yJJdNha4H68dhtzHd12T07ePZ7AUTRMYCxYuJhF7kNsA S70Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LvrIXz6W; 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 i11-20020a17090a974b00b0023fda10867dsi2166175pjw.130.2023.03.31.07.53.26; Fri, 31 Mar 2023 07:53:38 -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=LvrIXz6W; 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 S232311AbjCaOxA (ORCPT + 99 others); Fri, 31 Mar 2023 10:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjCaOwv (ORCPT ); Fri, 31 Mar 2023 10:52:51 -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 CCB2F1E71E for ; Fri, 31 Mar 2023 07:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680274283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+9i7sLun1jgv9svlyB9jcs4mFG0+IKoU4iPpMJ0u9ZQ=; b=LvrIXz6WGo4R2W2uI9IDoagN0uhNYZ+lsQGhOM1ptyhgMmSYRSzD/Qwq23rkkRRd27wkUn FgK3h8NE1D97TuTJ6TR6KdXJ/sJNHTHUnm5mSJbgEl/S1/Zm1oy+G16G4kXf5GaaE6KCAQ QSn11VCRyL9daNrOeW7ZR5jsSeVdQlg= 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-655-MV6FSdOcPKuZsRbCle0GAg-1; Fri, 31 Mar 2023 10:51:17 -0400 X-MC-Unique: MV6FSdOcPKuZsRbCle0GAg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9FF8884ED0; Fri, 31 Mar 2023 14:51:16 +0000 (UTC) Received: from llong.com (unknown [10.22.17.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53611492B02; Fri, 31 Mar 2023 14:51:16 +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 , gscrivan@redhat.com, Waiman Long Subject: [PATCH 2/3] cgroup/cpuset: Make cpuset_attach_task() skip subpartitions CPUs for top_cpuset Date: Fri, 31 Mar 2023 10:50:44 -0400 Message-Id: <20230331145045.2251683-3-longman@redhat.com> In-Reply-To: <20230331145045.2251683-1-longman@redhat.com> References: <20230331145045.2251683-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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 --- 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 f6d5614982d7..2367de611c42 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2530,7 +2530,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