Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4604556pxv; Tue, 20 Jul 2021 07:34:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjdcIP8SQ0cDRHk5as+d1VwgTMml4IhTAPrHaQtf7dnRJ/kYlXc5tMRLy0Bvl34pH2Sdkp X-Received: by 2002:a17:906:a202:: with SMTP id r2mr32468849ejy.398.1626791681209; Tue, 20 Jul 2021 07:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626791681; cv=none; d=google.com; s=arc-20160816; b=aroCkbfjgR8mJEEDp4b75T9z6/QBbfkIPxDJggZssO3AfVQ9P+KwQC+Sco5m0DU8qT 3aqhiN6SIw6kLrLiSsF+HpmL30gGwpnLEU0kZq+mEUSc/ngXeKaXV8QXnQG2EY2emsht l6u8psTu583DiKbEE1mlroJw0fo1WXKzGCS/rgc0bcD74pzMiNQy2N1e4V1ypDAkiDAA Z56elj1ZNbdjAg0PQq05uBiNlbUL+I5AJphqNLmnmWIUJc8HeZ0d1nZvT9QEI3aby29m wy3XjPmt4fu3ROVYuGfwwtA498DmKOMlOfI2BEBKg8CHB3dqlZu7pgIIk4sJcgH+pzyY AQcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=TB0+2ckjUrwSxwX0c/mMZfMQH7v5b2QE7Wq//06xzH0=; b=IYj13p69Qsrm8VOz9HfsZ1/i1iBCOu1/LLLSZlqtYUueP+jAMszQIbYaY7t5Q4Vx1m 1HSbueEH+UUjIuse1XBpT1q1h589RWRvE3WLqCFseNZ0zgK2x8sLkjIrh0eU42zoUlaT 2uLsXylBitjZZ+yZjzpssuIBDGqNvFxQAp7ZmwL0kw8bMATqEQAS+CS0+ewVvkAnqY/F 5h4b8yjB+iJd0uiri0KX+iNJLu3LB/fKdMFVgcH/c2gvZ+KM5+RbHNLRPLepGy/Yomw7 f38Pt6blUAHIbZk5rPR/rWZn9lhK7iUVbKR0Xxa5CqjnEpyepiY/+zOsotkfUuxJsAkf SpAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aVmLUPG4; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si24942302eji.716.2021.07.20.07.34.18; Tue, 20 Jul 2021 07:34:41 -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=@redhat.com header.s=mimecast20190719 header.b=aVmLUPG4; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237368AbhGTNwX (ORCPT + 99 others); Tue, 20 Jul 2021 09:52:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25574 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239838AbhGTNjN (ORCPT ); Tue, 20 Jul 2021 09:39:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626790791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=TB0+2ckjUrwSxwX0c/mMZfMQH7v5b2QE7Wq//06xzH0=; b=aVmLUPG4ouuO/JcTuCYH31LjeGsC5uwDSCED69eNPpIEf67rYQP8WcN3CzgrRm92KjEIkd Y37VtlLoczr0dmw5MbuVydigGbzf4WMjJy6HPAeL1qa+zLEs3Ywre3VqgCWD8EjITFG9a9 U2AHl/KZlr3qNgf4XMGzloviTA6B2yw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-418-WujaTHGHP0eImPyl6Z3_gQ-1; Tue, 20 Jul 2021 10:19:47 -0400 X-MC-Unique: WujaTHGHP0eImPyl6Z3_gQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB651100C660; Tue, 20 Jul 2021 14:19:45 +0000 (UTC) Received: from llong.com (ovpn-116-153.rdu2.redhat.com [10.10.116.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAE5E369A; Tue, 20 Jul 2021 14:19:40 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Shuah Khan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Roman Gushchin , Phil Auld , Peter Zijlstra , Juri Lelli , Frederic Weisbecker , Marcelo Tosatti , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Waiman Long Subject: [PATCH v3 2/9] cgroup/cpuset: Fix a partition bug with hotplug Date: Tue, 20 Jul 2021 10:18:27 -0400 Message-Id: <20210720141834.10624-3-longman@redhat.com> In-Reply-To: <20210720141834.10624-1-longman@redhat.com> References: <20210720141834.10624-1-longman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/cgroup/cpuset.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index f5fef5516d99..b00982e6f6d8 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 just 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.18.1