* [PATCH 1/4] percpu: remove redundant assignments to bits
2026-09-01 16:53 [PATCH 0/4] percpu: remove code with no effect Sang-Heon Jeon
@ 2026-09-01 16:53 ` Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 2/4] percpu: remove unnecessary initialization in pcpu_build_alloc_info() Sang-Heon Jeon
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-09-01 16:53 UTC (permalink / raw)
To: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton
Cc: linux-kernel, linux-mm
pcpu_chunk_refresh_hint() and pcpu_find_block_fit() set bits to 0 and
later call pcpu_next_md_free_region() or pcpu_next_fit_region(), which
unconditionally set *bits to 0. Nothing uses it in between, so the
assignments have no effect.
Remove redundant assignments.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
mm/percpu.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index a802d72c116f..5700385fe6a4 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -758,7 +758,6 @@ static void pcpu_chunk_refresh_hint(struct pcpu_chunk *chunk, bool full_scan)
chunk_md->contig_hint = 0;
}
- bits = 0;
pcpu_for_each_md_free_region(chunk, bit_off, bits)
pcpu_block_update(chunk_md, bit_off, bit_off + bits);
}
@@ -1122,7 +1121,6 @@ static int pcpu_find_block_fit(struct pcpu_chunk *chunk, int alloc_bits,
return -1;
bit_off = pcpu_next_hint(chunk_md, alloc_bits);
- bits = 0;
pcpu_for_each_fit_region(chunk, alloc_bits, align, bit_off, bits) {
if (!pop_only || pcpu_is_populated(chunk, bit_off, bits,
&next_off))
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] percpu: remove unnecessary initialization in pcpu_build_alloc_info()
2026-09-01 16:53 [PATCH 0/4] percpu: remove code with no effect Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 1/4] percpu: remove redundant assignments to bits Sang-Heon Jeon
@ 2026-09-01 16:53 ` Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 3/4] percpu: remove unnecessary cpumask_clear() " Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 4/4] percpu: remove unnecessary return in pcpu_populate_pte() Sang-Heon Jeon
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-09-01 16:53 UTC (permalink / raw)
To: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton
Cc: linux-kernel, linux-mm
pcpu_build_alloc_info() initializes nr_groups to 1 and unconditionally
sets it to the number of groups. Nothing uses it in between, so the
initialization has no effect.
Remove unnecessary initialization.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
mm/percpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index 5700385fe6a4..f222b43cc90a 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2817,7 +2817,7 @@ static struct pcpu_alloc_info * __init __flatten pcpu_build_alloc_info(
static int group_cnt[NR_CPUS] __initdata;
static struct cpumask mask __initdata;
const size_t static_size = __per_cpu_end - __per_cpu_start;
- int nr_groups = 1, nr_units = 0;
+ int nr_groups, nr_units = 0;
size_t size_sum, min_unit_size, alloc_size;
int upa, max_upa, best_upa; /* units_per_alloc */
int last_allocs, group, unit;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] percpu: remove unnecessary cpumask_clear() in pcpu_build_alloc_info()
2026-09-01 16:53 [PATCH 0/4] percpu: remove code with no effect Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 1/4] percpu: remove redundant assignments to bits Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 2/4] percpu: remove unnecessary initialization in pcpu_build_alloc_info() Sang-Heon Jeon
@ 2026-09-01 16:53 ` Sang-Heon Jeon
2026-09-01 16:53 ` [PATCH 4/4] percpu: remove unnecessary return in pcpu_populate_pte() Sang-Heon Jeon
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-09-01 16:53 UTC (permalink / raw)
To: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton
Cc: linux-kernel, linux-mm
pcpu_build_alloc_info() clears mask and unconditionally sets it to
cpu_possible_mask. Nothing uses it in between, so cpumask_clear() has
no effect.
Remove unnecessary cpumask_clear().
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
mm/percpu.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index f222b43cc90a..45f3e3fda2f9 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2828,7 +2828,6 @@ static struct pcpu_alloc_info * __init __flatten pcpu_build_alloc_info(
/* this function may be called multiple times */
memset(group_map, 0, sizeof(group_map));
memset(group_cnt, 0, sizeof(group_cnt));
- cpumask_clear(&mask);
/* calculate size_sum and ensure dyn_size is enough for early alloc */
size_sum = PFN_ALIGN(static_size + reserved_size +
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] percpu: remove unnecessary return in pcpu_populate_pte()
2026-09-01 16:53 [PATCH 0/4] percpu: remove code with no effect Sang-Heon Jeon
` (2 preceding siblings ...)
2026-09-01 16:53 ` [PATCH 3/4] percpu: remove unnecessary cpumask_clear() " Sang-Heon Jeon
@ 2026-09-01 16:53 ` Sang-Heon Jeon
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-09-01 16:53 UTC (permalink / raw)
To: Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton
Cc: linux-kernel, linux-mm
Since commit c6f239796b55 ("mm/memblock: add memblock_alloc_or_panic
interface"), pcpu_populate_pte() no longer has an error label after
the return statement, so the return statement has no effect.
Remove unnecessary return.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
mm/percpu.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index 45f3e3fda2f9..9df6cdf636fd 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -3178,8 +3178,6 @@ void __init __weak pcpu_populate_pte(unsigned long addr)
new = memblock_alloc_or_panic(PTE_TABLE_SIZE, PTE_TABLE_SIZE);
pmd_populate_kernel(&init_mm, pmd, new);
}
-
- return;
}
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread