On 2025-09-18 11:48:21 [+0300], Dragos Tatulea wrote:
quoted hunk ↗ jump to hunk
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index ba70569bd4b0..404064d893d6 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -768,6 +795,18 @@ static bool page_pool_recycle_in_cache(netmem_ref netmem,
return false;
}
+#ifdef CONFIG_DEBUG_PAGE_POOL_CACHE_RELEASE
+ if (unlikely(!page_pool_napi_local(pool))) {
if you do IS_ENABLED(CONFIG_DEBUG_PAGE_POOL_CACHE_RELEASE) you could
avoid the ifdef.
A quick question, where is this allow_direct argument supposed to come
from? I just noticed that mlx5 does
page_pool_put_unrefed_netmem(, true);
which then does not consider page_pool_napi_local(). But your proposed
change here will complain as it should.
+ u32 pp_cpuid = READ_ONCE(pool->cpuid);
+ u32 cpuid = smp_processor_id();
+
+ WARN_RATELIMIT(1, "page_pool %d: direct page release from wrong CPU %d, expected CPU %d",
+ pool->user.id, cpuid, pp_cpuid);
+
+ return false;
+ }
+#endif
+
/* Caller MUST have verified/know (page_ref_count(page) == 1) */
pool->alloc.cache[pool->alloc.count++] = netmem;
recycle_stat_inc(pool, cached);
Sebastian