Re: [PATCH v19 38/40] mm: percpu: increase PERCPU_DYNAMIC_SIZE_SHIFT on DEPT and large PAGE_SIZE
From: sashiko-bot
Date: Tue Jul 07 2026 - 03:59:50 EST
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch addresses a compile-time BUILD_BUG_ON failure that no longer exists, referencing a deleted structure (`struct kmem_cache_cpu`) and function (`alloc_kmem_cache_cpus()`). Both have been removed from the upstream kernel. The only remaining BUILD_BUG_ON checking `PERCPU_DYNAMIC_EARLY_SIZE` in SLUB is in `alloc_kmem_cache_stats()`, which evaluates `sizeof(struct kmem_cache_stats)`. Because `struct kmem_cache_stats` consists solely of an integer array, its size is entirely unaffected by `CONFIG_DEPT` or `local_lock_t`. Thus, this patch needlessly increases the dynamically reserved per-CPU memory based on an obsolete and misleading justification.
--
commit 279fb8fb2919a407c18ab625ec67d2a3430b7b4d
Author: Byungchul Park <byungchul@xxxxxx>
mm: percpu: increase PERCPU_DYNAMIC_SIZE_SHIFT on DEPT and large PAGE_SIZE
This commit increases PERCPU_DYNAMIC_SIZE_SHIFT to 11 when both CONFIG_DEPT
and a PAGE_SIZE larger than 4KiB are enabled. It aims to prevent a build
failure related to the size of struct kmem_cache_cpu.
> Yunseong reported a build failure due to the BUILD_BUG_ON() statement in
> alloc_kmem_cache_cpus(). In the following test:
>
> PERCPU_DYNAMIC_EARLY_SIZE < NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu)
[Severity: Medium]
Are we referencing structures and functions that have been removed from the
upstream kernel?
Both alloc_kmem_cache_cpus() and struct kmem_cache_cpu no longer exist
upstream. The only remaining BUILD_BUG_ON() checking PERCPU_DYNAMIC_EARLY_SIZE
in SLUB is in alloc_kmem_cache_stats():
mm/slub.c:alloc_kmem_cache_stats() {
BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH *
sizeof(struct kmem_cache_stats));
}
Since struct kmem_cache_stats consists solely of an integer array, its size
is entirely unaffected by CONFIG_DEPT or local_lock_t. Does this mean the
increase in dynamically reserved per-CPU memory is no longer needed?
> diff --git a/include/linux/percpu.h b/include/linux/percpu.h
> index 85bf8dd9f0874..dd74321d4bbd0 100644
> --- a/include/linux/percpu.h
> +++ b/include/linux/percpu.h
> @@ -43,7 +43,11 @@
> # define PERCPU_DYNAMIC_SIZE_SHIFT 12
> #endif /* LOCKDEP and PAGE_SIZE > 4KiB */
> #else
> +#if defined(CONFIG_DEPT) && !defined(CONFIG_PAGE_SIZE_4KB)
> +#define PERCPU_DYNAMIC_SIZE_SHIFT 11
> +#else
> #define PERCPU_DYNAMIC_SIZE_SHIFT 10
> +#endif /* DEPT and PAGE_SIZE > 4KiB */
> #endif
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706061928.66713-1-byungchul@xxxxxx?part=38