Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1862109pxb; Mon, 13 Sep 2021 07:08:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybiW8KTGe1TdjUYEHK2kCpd8x+PXkxRzp7k+5joCQQ0S0NHzfJ6F0gLpiG6rGlfrRyiP9t X-Received: by 2002:a05:6638:168a:: with SMTP id f10mr9920995jat.121.1631542097781; Mon, 13 Sep 2021 07:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631542097; cv=none; d=google.com; s=arc-20160816; b=Edtmh7S6OFlxDobS/MFsxgBGjy+XXAl63TZTID1LihBUOi28OYEcaPSHVrKiFqi9a0 NbPufXSIzUQ4T6ZC52sb++S1FDd8jwKdD8D3sIXrekg2g5XBd7MUxHaXd7zD1+bln5go Wgo4RBzSZXqp6EsdwYeCagLa2XwrLvzLN38YUGNh3+MPlEijZdXn1apzTokZojI77w25 +nUA8pKaIf8tla+G+k6jSHrku4Uv844LJigRwiTPyW1trIcNCKWNZ12b+cVd175rmTDv Laey/rqtXjMIxO66JT1+tALcVBaq+OyaOEZkt6Vpw579cs4mbYfbx8U4c9Nd753qLu0W nICA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+wwzf1reHXxvLQXOtpe6v2UVGrlbOUYuvD3Gh/jCCCc=; b=j+62jf6xTOGB1FYxiat6Zp10tI/e+FD0Wjzxbw/ndUZNMfv3u4xrRZT1b1V5Xnw4rH DisT87YOGrhzEjvbzls0Hy0ZFjzxD4zRNPtCsQd/xIQ/JzOeOnt4/eE/7LLSUzHYtta6 gBZjc0z8+UWRSq3fj/lQzeNuJXb1+fA/C1qSkBe783GiyydFkhmEPtQtz5jxFgzdJQW7 d9RNPgJ5xD3QMmxJTCDZ4rK0vOLa5oi+7NT3smR40ztVTtygxLO2FzwGzHsewsGaS7kG 1g/DMpIw0yyPCEM2v14WpZ2XUMerV21K1qtQ8gQUZ2iNPUN88jTXqgdsQ/wxPJqUcu9R joVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bhOSgsoo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 2si6124411iob.47.2021.09.13.07.08.00; Mon, 13 Sep 2021 07:08:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bhOSgsoo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244630AbhIMOHh (ORCPT + 99 others); Mon, 13 Sep 2021 10:07:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:55574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344068AbhIMODt (ORCPT ); Mon, 13 Sep 2021 10:03:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B11CE61A6E; Mon, 13 Sep 2021 13:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540344; bh=qEk3uD+l+IIHXcQHXoO4etyYJ0jv15YW+EmtSp2e+gU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bhOSgsooGluyo/fwzKcA5oOxIpS8eiT9jyNcTavDupbm9MrNV0aHa4XI9GAGoVY/h uMgdmIvwDd7HjzZyUmqG/QQ9ejgtoMFOz/lXgwLJCuSUmRNdH0yKleMx+M5Rrlcil2 oddDDT51XaFuu6Z5cj+X55ucaBLxKbdmosslXWnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Tejun Heo , Sasha Levin Subject: [PATCH 5.13 127/300] cgroup/cpuset: Fix a partition bug with hotplug Date: Mon, 13 Sep 2021 15:13:08 +0200 Message-Id: <20210913131113.688416893@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131109.253835823@linuxfoundation.org> References: <20210913131109.253835823@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Waiman Long [ Upstream commit 15d428e6fe77fffc3f4fff923336036f5496ef17 ] In cpuset_hotplug_workfn(), the detection of whether the cpu list has been changed is done by comparing the effective cpus of the top cpuset with the cpu_active_mask. However, in the rare case that just all the CPUs in the subparts_cpus are offlined, the detection fails and the partition states are not updated correctly. Fix it by forcing the cpus_updated flag to true in this particular case. Fixes: 4b842da276a8 ("cpuset: Make CPU hotplug work with partition") Signed-off-by: Waiman Long Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cpuset.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index adb5190c4429..592e9e37542f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3168,6 +3168,13 @@ static void cpuset_hotplug_workfn(struct work_struct *work) cpus_updated = !cpumask_equal(top_cpuset.effective_cpus, &new_cpus); mems_updated = !nodes_equal(top_cpuset.effective_mems, new_mems); + /* + * In the rare case that hotplug removes all the cpus in subparts_cpus, + * we assumed that cpus are updated. + */ + if (!cpus_updated && top_cpuset.nr_subparts_cpus) + cpus_updated = true; + /* synchronize cpus_allowed to cpu_active_mask */ if (cpus_updated) { spin_lock_irq(&callback_lock); -- 2.30.2