Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp83830pxb; Mon, 13 Sep 2021 13:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbjFYpNm0L8onyF3v404H5PazE86q1UBTRqDyFpiKyGnioTIzvXxehyAj7G8NuSgCg+MC4 X-Received: by 2002:a05:6402:493:: with SMTP id k19mr15498602edv.386.1631565322904; Mon, 13 Sep 2021 13:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631565322; cv=none; d=google.com; s=arc-20160816; b=CZcNwabYdsdVVaAbbcGXTPwY6bJ9tn8XGmChDZUoZtLnMpsNEWo1KjN6dj4kK1/kNo lesp5zWu8bYPKdkAEiQq3VEuYtb/RYfUKXD2dXbesvr5zw6y084kWrecx6nQLJfSqM0r 1YBldVFKq30sthk+hYjI42KkdhklkDi0W7eFMLb3Mte+6jeICnNRl06JHUJ5ADZEYqAH deyPIBFHUPf0yXwtaxEbg03UqmQGEps2Etb+bTazOR880Yr9zjlSSPzvn4IHewVJxMm3 VN5i2x/0FNn8G96XrjU/dXsTSfBFETssv+vTZvB9mnKYkLWO9vyBKr/Gi8fi+odqNPSm M4ng== 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=LF4HiN4likE6guZXiPHDIXN2QHN171sOo12ciaMp7fM=; b=S178otrhWxF/6on9/Y7Uxnban2/ZFRBFxF6CN7gTK6MskjOmje2qgQ8JtDY73SGhg6 WmJh2ItxZdJZNghH/y2yBlxG9/lHK82c/W1xAHeXy+nokQrRL18mW+NE7IsEc0vtXslg cMMnn+ONKJ9IFgxpeM8574naIXKIM9sUh8l75tYg4Pg2S9H91ZTkrurbcPtQS+z+2Ovt NT/SOFVoGICcUWRNPZS/qrpCnW2hlJ/uHQlJXy5r52mW4X5rFW8KcPg7I4qKIEcdlREa RDslFZ8MvozaHFD51lsVWjDr54JBoCSQjre+0mDSzuB7Fx4ttU5PJVmE0TUa6I1qVjbJ 1yzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b69BQFQD; 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 e15si8657306edl.72.2021.09.13.13.34.59; Mon, 13 Sep 2021 13:35:22 -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=b69BQFQD; 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 S242561AbhIMNmB (ORCPT + 99 others); Mon, 13 Sep 2021 09:42:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:37748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242326AbhIMNgU (ORCPT ); Mon, 13 Sep 2021 09:36:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 255C1613A5; Mon, 13 Sep 2021 13:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539658; bh=9s60/hmGtUabFvqryUmJCN2nkfZaoBKAEfL5FNuBKkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b69BQFQDPpVJpJrCkqhQvEFswhXoFUgXSF9U6Ch5BOmNba7bP+6B+IzuhmsGWVH6I Qwz8FKQK7PY/NQzosuMVug5U71oeVfuq/CyPhBWcR03acgnefnyTeuW5CWjdXsZANc fktlvBZMaD0nYCdEhGnb/GoZDDxEbnPZrN7T6gvY= 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.10 110/236] cgroup/cpuset: Fix a partition bug with hotplug Date: Mon, 13 Sep 2021 15:13:35 +0200 Message-Id: <20210913131104.082308864@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 53c70c470a38..e1601d8dac29 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