Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1826913pxb; Mon, 13 Sep 2021 06:26:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYkq1wsq9H2MopcUbMCP+cCLIYLVXGGIt1cYcbXc2dKQu0bNz6RKj8WFFBJl2oenAg03An X-Received: by 2002:a17:906:3148:: with SMTP id e8mr12375841eje.240.1631539568796; Mon, 13 Sep 2021 06:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631539568; cv=none; d=google.com; s=arc-20160816; b=XMhAOPcqZkWbFGYapxtspm9SknHrpzLxYblvD11tnLeXPgf8bEjGohqQXu200+BX25 zPzHd1/vSR413XWV9QxtA9c83qwe1tfNa5gCMHzZjR4naJyT2MT49cKTRiRi0Upk89rb axwqYPAhH9BZoL+VDz5Zgx3ZQv/5m0DNdSJiRlRwmUc1Ajt3AxwnoTh8btTW4kq0faUr Lb9I1DHYvlXR8l4wsy8chycBI24s7O1sxNrvT9jUDt49alI/DSuGkO3qbK7xxulNsGt7 qO+tw6Hv1hJEEsCe/vonBlxZoi78+OLdsT96lKfLivq7M7zLaiavsjf/kz8H/G3WIv5c Olew== 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=t4qtAtVwSmTic/iYxDy7SGK1T8X4xxNMDqgOcFeRj/M=; b=OlKnjbhxF0UH7IqhNqNnlDFe0QF+25nTNvMGjLjTtgwX8oVjummQA0v1Bg4dP6mj3Y FdrsWKoh69BrObob+kD28XGwgSskpk5Xz/Keuz0LtqoQpJkbwIRkz6jHmJ+rJAtzJdui ZxhrWjmGY5jNlUaATbM6hq/JyBI+ucJ+MxIKWLtJ3P/GkpW556qIRZquITTFeBf/TGJ4 +lYJZOXZR49RgG+0QFICUMtZUxHwY5SRV1KYFAjVlzFk49QS2GN8dV05vUsQHlC68l0N k9LY8huxK7tHAmTrtFAZbjzgoeHBnuUqLj4FRHvlXINKQ1Gw76KnRnY27HIhZ0qdxCur tlOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WRudvZQf; 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 a25si7212967ejc.304.2021.09.13.06.25.41; Mon, 13 Sep 2021 06:26:08 -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=WRudvZQf; 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 S241001AbhIMNWb (ORCPT + 99 others); Mon, 13 Sep 2021 09:22:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240573AbhIMNVB (ORCPT ); Mon, 13 Sep 2021 09:21:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4340A61106; Mon, 13 Sep 2021 13:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539175; bh=TveYUje6fNS3nR0Ug2zzbwvgiGmngjujV3jASCzfHlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRudvZQfEjo470M2hOI6aYhgPwH8wKpjAtJCBNbbJN50I5qdsC98kyN3299PGpeS3 hqkRLyN4XWaor3DOriYBMkp2tSMG/+CDh76qAGtHW1bLHJTixI7hj+NcYgS8C6Jwjs ZlzYvjo1ZZSh6TTQeDbvr2gse2Ue/L/jU22BeOnk= 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.4 070/144] cgroup/cpuset: Fix a partition bug with hotplug Date: Mon, 13 Sep 2021 15:14:11 +0200 Message-Id: <20210913131050.308709681@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@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 bab6a934862e..badfa8f15359 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3166,6 +3166,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