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 60CF433E37B for ; Wed, 17 Dec 2025 17:09:39 +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=1765991381; cv=none; b=S5ut0R5LHNr1+vRVSbvd9PBkWySKmvWlfS5uC3lFdLCqggb/0WEirtgiRcy8caMkGnndYu1nccA7/xcev1EpW/drTPdszE6WY/7c8i+iDUaT1dycWZpxji6D2ZM/OAu5T0NUec655kZ91m/n1tvgC+F00qN1bbiQ0JDGjRDMS3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765991381; c=relaxed/simple; bh=kKD4kzhWRMQvtxQzPfFJjPaIuXnbXKAXsUYn+tPm1Rc=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=pDKlpFauRI/NJPyJeFPgw5artodCZ/i+03L+GKl1P898+q5izRM5UDdcNR53lMtS2SFhuA/nc5OJHbVOyx/A8AVznNJ55a1SUSem3Pvo1op/jamJZLgdniC522g65KerWkOlsHNoMwSti3ShiJ7IRPBZ6LlcMngsXCmYjqjtxKQ= 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=AewiI/QT; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=oIddIlAt; 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="AewiI/QT"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="oIddIlAt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765991378; 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=cbJakwZRKMBXTIGpQKPp4Wc/aDYWRMed7IM81Pt8zs8=; b=AewiI/QT3H6x25AetdfHPVoyHZSZSSRIgQu94jJs6qlA/bitJxS4mpM40FzByLDQBkXJWF gmMcbXkvGvcCsrc3Nr0jTx4Dob8N4/GFgh8+tGzXFzRuJY/GhnhlefO2LnhS7XaPVW7b9K PevSCZRK7lsshxJPIJ9gHoEb4V66a80= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-zkbgUOiXOgOsJELM2RxNtQ-1; Wed, 17 Dec 2025 12:09:37 -0500 X-MC-Unique: zkbgUOiXOgOsJELM2RxNtQ-1 X-Mimecast-MFC-AGG-ID: zkbgUOiXOgOsJELM2RxNtQ_1765991377 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b2e235d4d2so2388289985a.3 for ; Wed, 17 Dec 2025 09:09:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1765991377; x=1766596177; 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=cbJakwZRKMBXTIGpQKPp4Wc/aDYWRMed7IM81Pt8zs8=; b=oIddIlAtA1uC9Kr5/C5qRLXIzSv8tNRsULA7ke+wo5Ju3YjDtejC/Xl0adArV/yNKK wCZnDjGw7KhNdmBAVeGLSa7SZFsDBAEMc8VA3IauvlXz7NlO6ILu1/bsThL0bjn9/K4S KNfzvM1VymmIjkk/hYDaxhgRtQ1ug9iY0/JA2i5EYJSwapiV9Y334+/+S788HcwcHOug LE74n2/VpD1CD8+4PR6MMUOf55saJbJowUWeNMu4xTf05ycyKREDS2e9z5QVTVCDeu7R 8i10BrBsSjdxRWAIV5v9TlCF7aoQO1XLH+q1Rw712PDXeH8S0kdp8UjcJWU6QT9HCoW1 TXzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765991377; x=1766596177; 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=cbJakwZRKMBXTIGpQKPp4Wc/aDYWRMed7IM81Pt8zs8=; b=OFFMLuS9zABcdOc70orUaHwBgTk8cPjqfQdQb3YACgxJDe2lYhqtFvddXWOBf5EoPW fn5bUUxqkldgTyssGl++C7BcqjOi675txxw/ecvlG2zdzoCy9gmEhf4YghyLuIVkKKJ9 j7X1aGSqt1czfPAzTL9+r727MkkSRPtDfHiGVGjld5QsfAFJEke66F4X6/wunfYcW7pV KgrUVmEHWRfBp9vjEd2ObsudrrBLgUtfuDTB9K7YMIeI6K53kdLa8A9UTORPcYRQ+nGf xJAOglPsu7F7vXix0FpgYuRRMOOtOQ5p3WCGxlvtqTNCEhs2FEF2WdcAhCkVDSSss1oY GAGQ== X-Forwarded-Encrypted: i=1; AJvYcCVzlZr1aoUJyg2TPVj+VtfpRkPxTXfzOmwJMNO4Q2SkMrzmCTMf8vDSozywQQki6qxwtUhWev31L//DiOg=@vger.kernel.org X-Gm-Message-State: AOJu0YwDCPs55cWlHU7CzI8FpMxS2wjUPvtjTPlnGhtqekn/GJKPc5hM STREgB8TKtz/nhz+SO8Jzbvy/Fg4lJrs57dMmKfps/W2x4YZFe8z6x9v9Sl3cnrE4YMq5ZlBpSd Uaogzv2dlwM8nDNzFzmvMnPfWO8hR9+jUUgSwbM8EiIex3k+WF3sPgTYBu5RH4WFTcg== X-Gm-Gg: AY/fxX6sihcNrQXX+V55LyGfBdbkxPYkV1wSYC/Y4yEX3wic5dICp6cVherBaErugUT dCvNNrVLY4c9/06uJYSrgPGgxGf5CDg1QI+pLoc/pfrqtP/WDTUbOHKRA7AkQuOwO1rZWIRCBh0 DzSyAUsN0kY52faGU2YoRwf3cF7do3m189fX+rmAFpcElZEGgmwdrIj0nESil27bwwEvUTOLfgA QsQODvQpGtjLKkM3Cs09SJ0yuLe4MGdrndv0vBRDSA8ZH7mfEGGtU9if6StQYlmhoj5dgX8PO5p frChT675Qy09FnWphSoCdr5EhQ77ENN9E/ooQuB5Y6FSruys3KdnLCB4ygsbc2JS6uydB4h91I5 QWVqkazGXJlgPr4CuflxemDKkxR0Fao/YpARzh7Vy2MaNVExKlzXCB7OO X-Received: by 2002:a05:620a:4114:b0:88f:561:d956 with SMTP id af79cd13be357-8bb398d7595mr2382686385a.13.1765991376613; Wed, 17 Dec 2025 09:09:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFqhJsrNzhCydzFRijBg7qqhqLAk21JTEuiW09xtDklyd0t69U4Zf/j6JkVlZU6SBaA1zm+Q== X-Received: by 2002:a05:620a:4114:b0:88f:561:d956 with SMTP id af79cd13be357-8bb398d7595mr2382681385a.13.1765991376127; Wed, 17 Dec 2025 09:09:36 -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-8be30d869ecsm437757885a.14.2025.12.17.09.09.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Dec 2025 09:09:35 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <249786b2-f715-4a46-be47-d6d3d6f35c10@redhat.com> Date: Wed, 17 Dec 2025 12:09:34 -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 4/6] cpuset: move update_domain_attr_tree to cpuset_v1.c To: Chen Ridong , tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com References: <20251217084942.2666405-1-chenridong@huaweicloud.com> <20251217084942.2666405-5-chenridong@huaweicloud.com> Content-Language: en-US In-Reply-To: <20251217084942.2666405-5-chenridong@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/17/25 3:49 AM, Chen Ridong wrote: > From: Chen Ridong > > Since relax_domain_level is only applicable to v1, move > update_domain_attr_tree() to cpuset-v1.c, which solely updates > relax_domain_level, > > Additionally, relax_domain_level is now initialized in cpuset1_inited. > Accordingly, the initialization of relax_domain_level in top_cpuset is > removed. The unnecessary remote_partition initialization in top_cpuset > is also cleaned up. > > As a result, relax_domain_level can be defined in cpuset only when > CONFIG_CPUSETS_V1=y. > > Signed-off-by: Chen Ridong > --- > kernel/cgroup/cpuset-internal.h | 11 ++++++++--- > kernel/cgroup/cpuset-v1.c | 28 ++++++++++++++++++++++++++++ > kernel/cgroup/cpuset.c | 31 ------------------------------- > 3 files changed, 36 insertions(+), 34 deletions(-) > > diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h > index a32517da8231..677053ffb913 100644 > --- a/kernel/cgroup/cpuset-internal.h > +++ b/kernel/cgroup/cpuset-internal.h > @@ -150,9 +150,6 @@ struct cpuset { > */ > int attach_in_progress; > > - /* for custom sched domain */ > - int relax_domain_level; > - > /* partition root state */ > int partition_root_state; > > @@ -182,6 +179,9 @@ struct cpuset { > > #ifdef CONFIG_CPUSETS_V1 > struct fmeter fmeter; /* memory_pressure filter */ > + > + /* for custom sched domain */ > + int relax_domain_level; > #endif > }; > > @@ -296,6 +296,8 @@ void cpuset1_hotplug_update_tasks(struct cpuset *cs, > int cpuset1_validate_change(struct cpuset *cur, struct cpuset *trial); > void cpuset1_init(struct cpuset *cs); > void cpuset1_online_css(struct cgroup_subsys_state *css); > +void update_domain_attr_tree(struct sched_domain_attr *dattr, > + struct cpuset *root_cs); > #else > static inline void cpuset1_update_task_spread_flags(struct cpuset *cs, > struct task_struct *tsk) {} > @@ -307,6 +309,9 @@ static inline int cpuset1_validate_change(struct cpuset *cur, > struct cpuset *trial) { return 0; } > static inline void cpuset1_init(struct cpuset *cs) {} > static inline void cpuset1_online_css(struct cgroup_subsys_state *css) {} > +static inline void update_domain_attr_tree(struct sched_domain_attr *dattr, > + struct cpuset *root_cs) {} > + > #endif /* CONFIG_CPUSETS_V1 */ > > #endif /* __CPUSET_INTERNAL_H */ > diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c > index 574df740f21a..95de6f2a4cc5 100644 > --- a/kernel/cgroup/cpuset-v1.c > +++ b/kernel/cgroup/cpuset-v1.c > @@ -502,6 +502,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, > void cpuset1_init(struct cpuset *cs) > { > fmeter_init(&cs->fmeter); > + cs->relax_domain_level = -1; > } > > void cpuset1_online_css(struct cgroup_subsys_state *css) > @@ -552,6 +553,33 @@ void cpuset1_online_css(struct cgroup_subsys_state *css) > cpuset_callback_unlock_irq(); > } > > +static void > +update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c) > +{ > + if (dattr->relax_domain_level < c->relax_domain_level) > + dattr->relax_domain_level = c->relax_domain_level; > +} > + > +void update_domain_attr_tree(struct sched_domain_attr *dattr, > + struct cpuset *root_cs) > +{ > + struct cpuset *cp; > + struct cgroup_subsys_state *pos_css; > + > + rcu_read_lock(); > + cpuset_for_each_descendant_pre(cp, pos_css, root_cs) { > + /* skip the whole subtree if @cp doesn't have any CPU */ > + if (cpumask_empty(cp->cpus_allowed)) { > + pos_css = css_rightmost_descendant(pos_css); > + continue; > + } > + > + if (is_sched_load_balance(cp)) > + update_domain_attr(dattr, cp); > + } > + rcu_read_unlock(); > +} > + > /* > * for the common functions, 'private' gives the type of file > */ > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index e836a1f2b951..88ca8b40e01a 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -215,8 +215,6 @@ static struct cpuset top_cpuset = { > .flags = BIT(CS_CPU_EXCLUSIVE) | > BIT(CS_MEM_EXCLUSIVE) | BIT(CS_SCHED_LOAD_BALANCE), > .partition_root_state = PRS_ROOT, > - .relax_domain_level = -1, As the cpuset1_init() function will not be called for top_cpuset, you should not remove the initialization of relax_domain_level. Instead, put it inside a "ifdef CONFIG_CPUSETS_V1 block. > - .remote_partition = false, Yes, this is not really needed and can be removed. Cheers, Longman