From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3BD537E30A for ; Wed, 4 Mar 2026 04:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772597166; cv=none; b=TshMKao0FMG6+O6k7dzk4ho8yFmmpEHvjtoYibwKXPFpbzZLntdochGPsaqLZm4YEGO9QvZBhvrJdAJuRf0bEfZRHQbuZftWyTuXwYJJBArfvrwOp6of23wLGOhDVz2PoxoBWOJuG2+6uiGHRU1kjxffko+8YujlRQmDVtCCfSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772597166; c=relaxed/simple; bh=YVxRuP0NXDSbyXtnCqrLI757OLMnWV+voqvrCqEQOlU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=k6Juo+lvaU8I0WJ1uOyigGAF6oD3ilL7nXt0u7GiM5aHwiQAEpGBt1EsL0c3b/WLDURgnjBqFk0PBnBMOd5+NDdqnlL9UKS0M7gT3Q+fTdOXxuR0X7X7OvItEC66oPJuEOif9cedd19+UKWeIoIwFIMBhxoLSRk8A29yglSi//Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JGjgKSyX; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JGjgKSyX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772597164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OVLfMHz3uFZGKoEzvvxcxpvEYhM/ojSOYfndv2rw0os=; b=JGjgKSyXmXqxOX6jp9V6EtTgGCNhmqohYJND5ALy1Fh459/QcFBFmXXdp2FXLyi8GOffMV cY1+uqdrlSFIMlqSCn/fpYhQPOYWoP795+ZEjS0lwKg72IpTMXeKjLVTDh8ZVsglGZcAG2 bsG2yg8XsSS6WxtObQNzaQ4OU27+C1Q= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-361-4cjsy1NyPzmCUgOhkCVbLQ-1; Tue, 03 Mar 2026 23:05:58 -0500 X-MC-Unique: 4cjsy1NyPzmCUgOhkCVbLQ-1 X-Mimecast-MFC-AGG-ID: 4cjsy1NyPzmCUgOhkCVbLQ_1772597156 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 88F631956089; Wed, 4 Mar 2026 04:05:55 +0000 (UTC) Received: from [10.22.64.108] (unknown [10.22.64.108]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CFF9E300019F; Wed, 4 Mar 2026 04:05:51 +0000 (UTC) Message-ID: Date: Tue, 3 Mar 2026 23:05:51 -0500 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 7/8] cgroup/cpuset: Defer housekeeping_update() calls from CPU hotplug to workqueue To: Frederic Weisbecker Cc: Chen Ridong , Tejun Heo , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , Shuah Khan , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20260221185418.29319-1-longman@redhat.com> <20260221185418.29319-8-longman@redhat.com> Content-Language: en-US From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 3/3/26 5:48 PM, Frederic Weisbecker wrote: > Le Tue, Mar 03, 2026 at 11:00:54AM -0500, Waiman Long a écrit : >> On 2/26/26 11:06 AM, Frederic Weisbecker wrote: >> If you look at the work function, it will make a copy of HK_TYPE_DOMAIN >> cpumask while holding rcu_read_lock(). > Where? > >> So the current hotplug operation must >> have finished at that point. > I'm confused. This is called from sched_cpu_deactivate(), right? > So the work is scheduled at that point. But the work does cpuset_full_lock() > which includes cpu hotplug read lock, so the sched domain rebuild can only > happen at the end of cpu_down(). > > This means that between CPUHP_TEARDOWN_CPU and CPUHP_OFFLINE, the offline > CPU still appears in the scheduler topology because the scheduler domains > haven't been rebuilt. > > And even if the work wouldn't cpu hotplug read lock, what guarantees that > it executes before reaching CPUHP_TEARDOWN_CPU? > >> Of course, if there is another hot-add/remove >> operation right after the rcu_read_lock is released, the cpumask passed down >> to housekeeping_update() may not be the latest one. In this case, another >> work will be scheduled to call housekeeping_update() with the new cpumask >> again. > I'm not so much worried about housekeeping_update() (yet). I'm worried about > topology rebuild to happen before CPUHP_TEARDOWN_CPU. Offline CPUs shouldn't > exist in the topology. Yes, I am aware that this could be a problem. I am working on a fix patch that will always do a rebuild_sched_domains_cpuslocked() call directly in the hotplug path if needed as shown in the patch that I sent to Jon. I want to get a confirmation first before I send it out. There will be other minor code/comment adjustments as well. Cheers, Longman