Message ID | 20210111182801.12609-3-alobakin@pm.me (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | skbuff: introduce skbuff_heads bulking and reusing | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 11 of 11 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3c904c29efbb..0e8c597ff6ce 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -487,6 +487,9 @@ EXPORT_SYMBOL(__netdev_alloc_skb); static struct sk_buff *__napi_decache_skb(struct napi_alloc_cache *nc) { + if (nc->flush_skb_count) + return nc->flush_skb_cache[--nc->flush_skb_count]; + return kmem_cache_alloc(skbuff_head_cache, GFP_ATOMIC); }
Instead of unconditional allocating a new skbuff_head and unconditional flushing of flush_skb_cache, reuse the ones queued up for flushing if there are any. skbuff_heads stored in flush_skb_cache are already unreferenced from any pages or extensions and almost ready for use. We perform zeroing in __napi_alloc_skb() anyway, regardless of where did our skbuff_head came from. Signed-off-by: Alexander Lobakin <alobakin@pm.me> --- net/core/skbuff.c | 3 +++ 1 file changed, 3 insertions(+)