From nobody Fri Dec 19 11:32:26 2025 Received: from chinatelecom.cn (smtph3-07.21cn.com [150.223.194.132]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2B0A3112B3 for ; Mon, 8 Dec 2025 09:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.223.194.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765186699; cv=none; b=Tkb0pyB8w/QclaQoJnHxggTKUrboR4ZWqZUbemoagOJHf+BFl1ZDsszWDeOW6pq8dqP7+f9z86pmOvkKr9Qw6kPZuxdzEvkgNctwSy/If6y0xC4OBv+xlTGtyNva8jhld9avohQO/f86/i7gVPCV7J+q77tVvsn4MdTxWSlRq14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765186699; c=relaxed/simple; bh=LIwG+Yxmpkgor/aLLSl2Kl2dV8HgStnAt5MfQpiO/Yk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=StL3+7OYHJxBNc2R2m6glyyCi2F/h4nGedk9FbTmMBXq8/K9xdakl+REEdGycJ8P8pWwbgsTcZf0v8JmtYOg6NDGqUZWTOnO0B7TUjPg7LO07St4h5jqkQgOBjSkTFtiHFHR7OcuRlU7BoKN71F0zVMcALEEgh/nEHVwQ1/OlG4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chinatelecom.cn; spf=pass smtp.mailfrom=chinatelecom.cn; arc=none smtp.client-ip=150.223.194.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chinatelecom.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chinatelecom.cn HMM_SOURCE_IP: 172.27.0.98:0.584789079 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-101.227.46.167 (unknown [172.27.0.98]) by chinatelecom.cn (HERMES) with SMTP id 611A9155000; Mon, 8 Dec 2025 17:26:35 +0800 (CST) X-189-SAVE-TO-SEND: +niuwl1@chinatelecom.cn Received: from ([101.227.46.167]) by gateway-ssl-dep-55bdcd6d8-9n4lz with ESMTP id dfdb5f6b9a3f412a93f2afe8bc1bb503 for dennis@kernel.org; Mon, 08 Dec 2025 17:26:46 CST X-Transaction-ID: dfdb5f6b9a3f412a93f2afe8bc1bb503 X-Real-From: niuwl1@chinatelecom.cn X-Receive-IP: 101.227.46.167 X-MEDUSA-Status: 0 Sender: niuwl1@chinatelecom.cn From: WanLi Niu To: Dennis Zhou Cc: Tejun Heo , Christoph Lameter , Andrew Morton , WanLi Niu , hlleng , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/percpu: drop unused max_upa in pcpu_build_alloc_info() Date: Mon, 8 Dec 2025 17:26:27 +0800 Message-Id: <20251208092627.5603-1-niuwl1@chinatelecom.cn> X-Mailer: git-send-email 2.39.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pcpu_build_alloc_info() only needs the initial upa as the starting point for the downward search. Storing it in max_upa and reusing it adds no value. Iterate from upa directly to remove the redundant local variable without changing behavior, improving readability. Signed-off-by: WanLi Niu Co-developed-by: hlleng Signed-off-by: hlleng --- mm/percpu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 81462ce58..966f4405f 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -2800,7 +2800,7 @@ static struct pcpu_alloc_info * __init __flatten pcpu= _build_alloc_info( const size_t static_size =3D __per_cpu_end - __per_cpu_start; int nr_groups =3D 1, nr_units =3D 0; size_t size_sum, min_unit_size, alloc_size; - int upa, max_upa, best_upa; /* units_per_alloc */ + int upa, best_upa; /* units_per_alloc */ int last_allocs, group, unit; unsigned int cpu, tcpu; struct pcpu_alloc_info *ai; @@ -2817,7 +2817,7 @@ static struct pcpu_alloc_info * __init __flatten pcpu= _build_alloc_info( dyn_size =3D size_sum - static_size - reserved_size; =20 /* - * Determine min_unit_size, alloc_size and max_upa such that + * Determine min_unit_size, alloc_size such that * alloc_size is multiple of atom_size and is the smallest * which can accommodate 4k aligned segments which are equal to * or larger than min_unit_size. @@ -2829,7 +2829,6 @@ static struct pcpu_alloc_info * __init __flatten pcpu= _build_alloc_info( upa =3D alloc_size / min_unit_size; while (alloc_size % upa || (offset_in_page(alloc_size / upa))) upa--; - max_upa =3D upa; =20 cpumask_copy(&mask, cpu_possible_mask); =20 @@ -2860,7 +2859,7 @@ static struct pcpu_alloc_info * __init __flatten pcpu= _build_alloc_info( */ last_allocs =3D INT_MAX; best_upa =3D 0; - for (upa =3D max_upa; upa; upa--) { + for (; upa; upa--) { int allocs =3D 0, wasted =3D 0; =20 if (alloc_size % upa || (offset_in_page(alloc_size / upa))) --=20 2.39.1