Skip to contentSkip to conversation

add-a-slab-for-ethernet.patch

PATCH Andrew Morton 2 participants 2 messages Apr 13, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I've been sitting on this for a while:

From: Manfred Spraul <[email protected]>

Improve the packing density for 1536-byte ethernet frames on 8k or larger page size machines.

The slab has 1620 bytes - 5 should fit into one page (1620*5+40 bytes slab+5*4 bufctl - 32 bytes should remain unused on 64-bit archs).

---

 25-akpm/include/linux/kmalloc_sizes.h |    3 +++
 1 files changed, 3 insertions(+)
include/linux/kmalloc_sizes.h renamed from include/linux/kmalloc_sizes.h~add-a-slab-for-ethernet +3 -0
diff -puN include/linux/kmalloc_sizes.h~add-a-slab-for-ethernet include/linux/kmalloc_sizes.h
@@ -12,6 +12,9 @@
 	CACHE(256)
 	CACHE(512)
 	CACHE(1024)
+#if (PAGE_SIZE != 4096)	/* special cache for eth skbs - 5 fit into one 8 kB page */
+	CACHE(1620)
+#endif
 	CACHE(2048)
 	CACHE(4096)
 	CACHE(8192)

_

Problem is, I'm not sure it's worth the effort - it seems that the system just never has that many full-sized ethernet frames floating about, so we don't save significant amounts of memory.

Am I wrong?

#1 lore raw

include/linux/kmalloc_sizes.h line 17

Quoted 3 lines · Andrew Morton
include/linux/kmalloc_sizes.h renamed from include/linux/kmalloc_sizes.h~add-a-slab-for-ethernet +3 -0
+#if (PAGE_SIZE != 4096)	/* special cache for eth skbs - 5 fit into one 8 kB page */
+	CACHE(1620)
+#endif

Nitpicks:

1. Shouldn't this be (PAGE_SIZE > 4096)? Yeah, it's not very likely that we'll ever have to support an arch w/ a page size <4K (I believe the linux-vax port uses 4K superpages, not the 1K native page size) but it doesn't hurt to be careful.

2. Maybe also add "&& defined(CONFIG_NET)" to that? You could also argue for CONFIG_ETHERNET but there's lots of cases where people might want to use ethernet-sized frames (bridged over ATM, whatever) even if they don't have any ethernet cards installed.

Doubt there's too many people with 8K page sizes and no networking support compiled in... but today's high-end is tomorrow's embedded processor :-)

-Mitch