Skip to contentSkip to conversation

ynl: samples: fix recycling rate calculation

PATCH Applied Jakub Kicinski 2 participants 2 messages Mar 7, 2024 – Mar 11, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 ynl: samples: fix recycling rate calculation

Running the page-pool sample on production machines under moderate networking load shows recycling rate higher than 100%:

$ page-pool
    eth0[2]	page pools: 14 (zombies: 0)
		refs: 89088 bytes: 364904448 (refs: 0 bytes: 0)
		recycling: 100.3% (alloc: 1392:2290247724 recycle: 469289484:1828235386)

Note that outstanding refs (89088) == slow alloc * cache size (1392 * 64) which means this machine is recycling page pool pages perfectly, not a single page has been released.

The extra 0.3% is because sample ignores allocations from the ptr_ring. Treat those the same as alloc_fast, the ring vs cache alloc is already captured accurately enough by recycling stats.

With the fix:

$ page-pool
    eth0[2]	page pools: 14 (zombies: 0)
		refs: 89088 bytes: 364904448 (refs: 0 bytes: 0)
		recycling: 100.0% (alloc: 1392:2331141604 recycle: 473625579:1857460661)

---
CC: [email protected]

---
 tools/net/ynl/samples/page-pool.c | 2 ++
 1 file changed, 2 insertions(+)
tools/net/ynl/samples/page-pool.c +2 -0
index 098b5190d0e5..332f281ee5cb 100644
@@ -95,6 +95,8 @@ int main(int argc, char **argv)
 
 		if (pp->_present.alloc_fast)
 			s->alloc_fast += pp->alloc_fast;
+		if (pp->_present.alloc_refill)
+			s->alloc_fast += pp->alloc_refill;
 		if (pp->_present.alloc_slow)
 			s->alloc_slow += pp->alloc_slow;
 		if (pp->_present.recycle_ring)
Signature · 1 line
2.44.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 9 lines · On Thu, 7 Mar 2024 14:11:22 -0800 you wrote:

Running the page-pool sample on production machines under moderate networking load shows recycling rate higher than 100%:

$ page-pool
    eth0[2]	page pools: 14 (zombies: 0)
		refs: 89088 bytes: 364904448 (refs: 0 bytes: 0)
		recycling: 100.3% (alloc: 1392:2290247724 recycle: 469289484:1828235386)

[...]

Here is the summary with links:
- [net-next] ynl: samples: fix recycling rate calculation

    https://git.kernel.org/netdev/net-next/c/900b2801bf25

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html