Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: Use __napi_alloc_frag_align() instead of open coding it.

The else condition within __netdev_alloc_frag_align() is an open coded
__napi_alloc_frag_align().

Use __napi_alloc_frag_align() instead of open coding it.
Move fragsz assignment before page_frag_alloc_align() invocation because
__napi_alloc_frag_align() also contains this statement.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://patch.msgid.link/20240620132727.660738-4-bigeasy@linutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Sebastian Andrzej Siewior and committed by
Jakub Kicinski
43d7ca29 c5bcab75

+2 -6
+2 -6
net/core/skbuff.c
··· 318 318 { 319 319 void *data; 320 320 321 - fragsz = SKB_DATA_ALIGN(fragsz); 322 321 if (in_hardirq() || irqs_disabled()) { 323 322 struct page_frag_cache *nc = this_cpu_ptr(&netdev_alloc_cache); 324 323 324 + fragsz = SKB_DATA_ALIGN(fragsz); 325 325 data = __page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, 326 326 align_mask); 327 327 } else { 328 - struct napi_alloc_cache *nc; 329 - 330 328 local_bh_disable(); 331 - nc = this_cpu_ptr(&napi_alloc_cache); 332 - data = __page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC, 333 - align_mask); 329 + data = __napi_alloc_frag_align(fragsz, align_mask); 334 330 local_bh_enable(); 335 331 } 336 332 return data;