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.133.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 13921246BD5 for ; Wed, 26 Nov 2025 02:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764124443; cv=none; b=Pn8aMHkzdUWbWfvhOakzzRHQAFuXs5Tc6hi7pCLA1IENQIZFt60GO6xltUKbRp+y/2d8Cp2haKvjwf1ewm8Jq+5TjRNTYQFhUM1J85QM+/y4a0/u/9Mh4Yl+66CpOK8FOrArg+uoqcUqSy9x8FLecL23dSf6zZcJEJ9L4jR1YYY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764124443; c=relaxed/simple; bh=+LFFjhNbu5lZSrbuLBmkZYtjhNsOgYEfLOKDDeFGLU8=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=kfpDjM6mbws/d6fw3CAgK6iC/mGphghmJQagf6v86XoYBJ33xsnSA6v1gd0XuJoigsJAYLXN3Y474dOT2kxqQLf+5TnJmkvlppPTuPIUbN4iqvULZ+Ak5b4TRGGy3Uixinu29FVATNgTMMKVzn5YTeelORpuQXCZQb77xrMMTo8= 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=cUhdaulf; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=jBqI0DPh; arc=none smtp.client-ip=170.10.133.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="cUhdaulf"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="jBqI0DPh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764124440; 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=khR6G5j6LeYnYLREff6usfxODvmiqoKm6G0Zfw20k9A=; b=cUhdaulfpVESc4RDj04qwZ1K2BJn2Y3iHi/bsQm/pYU9Ng4BoggT3i3vPOgTIeMCJwrjIC iwfPztrmfj0ny6a8Vph6r3cl9mOjFsmjw5d5TIVKvqpPQ8PxLOwvicZRhhSheawYwTujvP n3R7FQfREqU5tCTuNohMYQsP2kg5Qmo= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-548-XeVfmO2UMXKmUzKbfZH4Kg-1; Tue, 25 Nov 2025 21:33:57 -0500 X-MC-Unique: XeVfmO2UMXKmUzKbfZH4Kg-1 X-Mimecast-MFC-AGG-ID: XeVfmO2UMXKmUzKbfZH4Kg_1764124437 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b2e235d4d2so2278670385a.3 for ; Tue, 25 Nov 2025 18:33:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764124437; x=1764729237; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=khR6G5j6LeYnYLREff6usfxODvmiqoKm6G0Zfw20k9A=; b=jBqI0DPhsqDvTb15+lBKqFXpsOixku07CvrYM71fQwh6a+t5smZ0f5P7BC3bu8Q1fg lGnI/1yLEj5xjBgm9rjjodCB0nOXoDa+OtukrrojlXh8ivTzLvGPF3ZzQPOZDcUvdbJ3 UIhrFmEW8+J16XKnzfe8TToEjjtXur/cLlZNP8puN1AVNHRPT190s+63Iu1isRqeXZQW ZUNqNSuNIfKeXEHkbQ+lR9/yBMIDqtLIyOBsVNcU3/P7c8CYGJu5HkO2bawJxJiX3a2M Hw3HwDBNZGWkcqZHEEqSamqbBWYFjmo6BX/AEDRprtXlJ63DQtArauD4e4ihwKJ1bXc/ rF9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764124437; x=1764729237; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=khR6G5j6LeYnYLREff6usfxODvmiqoKm6G0Zfw20k9A=; b=fdUFWUGKhNkrHTh/Wq+mab9otNwASXYSczKXdeiBVjVq3Dd4aMVYMR1puyL0uP+1Be W8qdJPetc531WCOdrZwAGJ3OGVfARSipVf+SMOz1SFZjiqAu3Ypy5rnIEUMAjK5FJ0iN JgP/MNt0dCk/2IzM7E9stfyC2jxXz+f/6I74So/wd3VhnH4h1vrf3Euio5eFYYMvoUnf TXUugsz+BIgL13ZHNe9ChTtEeZAZia7GuZoY47/sZ/8Hq4JA85+prtatbhMHm28CkzwA yunXHWWGHgEs4yZv/WwGMw6fCNo09hf1L/MyK1ZKSXXmdaZpL/+HaRCRPCTP9dwTxlLR nIdg== X-Forwarded-Encrypted: i=1; AJvYcCXN51KUWZhb/sPpt1vRCnp+6ntVNIjXbocKd+hrEmSYwLKN57z0KK06x+GGmAkD1nh+FplUV70Wgzhn7Eo=@vger.kernel.org X-Gm-Message-State: AOJu0YwIIoPk97Lnk4a3uZEKmX0weLlnzNUL7Py+Wy5ExXCncs/6sboA 9Uz0shMjCxbNkJ3wg252BsKdo5ObQqPpIylMQt6WPaydVnj6q4djA/kkNE8xFZU/vVRshHyJW1V p0tJv5urRlaLmjLcB0kufsHdiDG3DsSnWZz2K+ptWRNwRVWDnjg8jPC33ep0P5DCydw== X-Gm-Gg: ASbGncumk5s71PWjVwgAsYhkYYWMQ8lHKAuukAOl4OvihnLIDHt5QyDJgzKA04hOhry xmjmyrUcBDETImPNUbFk7oD4CJocJwSn2Sr2XtfIlKjImyNc3XSLtXnIc2Qv61pwPeXk+BgMlJd rPXlUQRjNBkQiOEL52m5ZqrJ033qgI3/SoSD2Sj9tjZHlVVbRSZNRyMcgGd7RZBEzeY+eVKLIFF m9E6DYJj9S49Qna2hZkOmUfegnXx/tngNzf5krjE2jSyfLG/cpKYwQ8XhdL8PT9ZQgzf7mB/qXM Bmk1rFDPHvuGrxZAD6i/ql64dW05RZ/VPKQcUhH1Ob6SL0kKCSLNknoP5lZR8Z5aU/JNpT4wcfR YozBb9YMA30P4meTBKRu5/MuaeSG8irmqZftuzkFq+/BmU53JjuWfitac X-Received: by 2002:a05:620a:472c:b0:8b2:f29e:3afa with SMTP id af79cd13be357-8b33d4a74ffmr2175762585a.45.1764124436921; Tue, 25 Nov 2025 18:33:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/TeCaSeghqdxyn0kLeVMxodP41ayP8g58ovmVJ2Z6pGjUXF1b5dxQK9qisPQXAoSh6f18uA== X-Received: by 2002:a05:620a:472c:b0:8b2:f29e:3afa with SMTP id af79cd13be357-8b33d4a74ffmr2175759885a.45.1764124436552; Tue, 25 Nov 2025 18:33:56 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b3295eefb6sm1299270585a.50.2025.11.25.18.33.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Nov 2025 18:33:55 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: Date: Tue, 25 Nov 2025 21:33:54 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -next] cpuset: Remove unnecessary checks in rebuild_sched_domains_locked To: Chen Ridong , Waiman Long , tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, daniel.m.jordan@oracle.com, lujialin4@huawei.com, chenridong@huawei.com References: <20251118083643.1363020-1-chenridong@huaweicloud.com> <27ed2c0b-7b00-4be0-a134-3c370cf85d8e@redhat.com> <0ecb1476-2886-430f-a698-cabbe9302129@huaweicloud.com> Content-Language: en-US In-Reply-To: <0ecb1476-2886-430f-a698-cabbe9302129@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 11/25/25 8:01 PM, Chen Ridong wrote: > > On 2025/11/26 2:16, Waiman Long wrote: >>> active CPUs, preventing partition_sched_domains from being invoked with >>> offline CPUs. >>> >>> Signed-off-by: Chen Ridong >>> --- >>>   kernel/cgroup/cpuset.c | 29 ++++++----------------------- >>>   1 file changed, 6 insertions(+), 23 deletions(-) >>> >>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c >>> index daf813386260..1ac58e3f26b4 100644 >>> --- a/kernel/cgroup/cpuset.c >>> +++ b/kernel/cgroup/cpuset.c >>> @@ -1084,11 +1084,10 @@ void dl_rebuild_rd_accounting(void) >>>    */ >>>   void rebuild_sched_domains_locked(void) >>>   { >>> -    struct cgroup_subsys_state *pos_css; >>>       struct sched_domain_attr *attr; >>>       cpumask_var_t *doms; >>> -    struct cpuset *cs; >>>       int ndoms; >>> +    int i; >>>         lockdep_assert_cpus_held(); >>>       lockdep_assert_held(&cpuset_mutex); >> In fact, the following code and the comments above in rebuild_sched_domains_locked() are also no >> longer relevant. So you may remove them as well. >> >>         if (!top_cpuset.nr_subparts_cpus && >>             !cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) >>                 return; >> > Thank you for reminding me. > > I initially retained this code because I believed it was still required for cgroup v1, as I recalled > that synchronous operation is exclusive to cgroup v2. > > However, upon re-examining the code, I confirm it can be safely removed. For cgroup v1, > rebuild_sched_domains_locked is called synchronously, and only the migration task (handled by > cpuset_migrate_tasks_workfn) operates asynchronously. Consequently, cpuset_hotplug_workfn is > guaranteed to complete before the hotplug workflow finishes. Yes, v1 still have a task migration part that is done asynchronously because of the lock ordering issue. Even if this code has to be left because of v1, you should still update the comment to reflect that. Please try to keep the comment updated to help others to have a better understanding of what the code is doing. Thanks, Longman