[openwrt/openwrt] kernel: add workaround for page_pool_release warnings

LEDE Commits lede-commits at lists.infradead.org
Fri Jan 3 11:23:52 PST 2025


nbd pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/bbfebf85273cf8e7c99fa9d1e40c7fa6b5602390

commit bbfebf85273cf8e7c99fa9d1e40c7fa6b5602390
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Jan 3 20:22:13 2025 +0100

    kernel: add workaround for page_pool_release warnings
    
    defer_list skbs held by NAPI can block releasing page pools.
    Work around this by scheduling rx softirq on all CPUs while trying to release
    a page pool.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
    (cherry picked from commit 2b70b32aef9e8e1ff275872d551c610368079911)
---
 ...ol-try-to-free-deferred-skbs-while-waitin.patch | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch
new file mode 100644
index 0000000000..36c28b94f6
--- /dev/null
+++ b/target/linux/generic/hack-6.6/610-net-page_pool-try-to-free-deferred-skbs-while-waitin.patch
@@ -0,0 +1,43 @@
+From: Felix Fietkau <nbd at nbd.name>
+Date: Fri, 3 Jan 2025 19:29:00 +0100
+Subject: [PATCH] net: page_pool: try to free deferred skbs while waiting for
+ pool release
+
+The NAPI defer list can accumulate no longer used skbs, which can be reused
+during alloc. If this happens on a CPU that otherwise does not do any
+rx softirq processing, skbs can be held indefinitely, causing warnings
+on releasing page pools.
+Deal with this by scheduling rx softirq on all CPUs.
+
+Patch by Lorenzo Bianconi
+
+Signed-off-by: Felix Fietkau <nbd at nbd.name>
+---
+
+--- a/net/core/page_pool.c
++++ b/net/core/page_pool.c
+@@ -862,12 +862,23 @@ static void page_pool_release_retry(stru
+ {
+ 	struct delayed_work *dwq = to_delayed_work(wq);
+ 	struct page_pool *pool = container_of(dwq, typeof(*pool), release_dw);
+-	int inflight;
++	int cpu, inflight;
+ 
+ 	inflight = page_pool_release(pool);
+ 	if (!inflight)
+ 		return;
+ 
++	/* Run NET_RX_SOFTIRQ in order to free pending skbs in softnet_data
++	 * defer_list that can stay in the list until we have enough queued
++	 * traffic.
++	 */
++	for_each_online_cpu(cpu) {
++		struct softnet_data *sd = &per_cpu(softnet_data, cpu);
++
++		if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1))
++			smp_call_function_single_async(cpu, &sd->defer_csd);
++	}
++
+ 	/* Periodic warning */
+ 	if (time_after_eq(jiffies, pool->defer_warn)) {
+ 		int sec = (s32)((u32)jiffies - (u32)pool->defer_start) / HZ;




More information about the lede-commits mailing list