[Devel] [PATCH vz7 v2] napi: Suppress warnings on memory allocation failure.

Oleg Babin obabin at virtuozzo.com
Tue Mar 13 15:24:27 MSK 2018


A network driver can allocate socket buffers in a softirq context but
if the allocation fails then a warning will be produced to the dmesg.
A lot of such warnings could slow down the whole system as a printing
to dmesg can be very time-consuming (especially in a situation of low
memory). Also network drivers usually have appropriate stats counter
(like 'alloc_rx_buff_failed') which can be obtained using ethtool.

Suppress this warnings using __GFP_NOWARN flag.

https://jira.sw.ru/browse/PSBM-82315
Signed-off-by: Oleg Babin <obabin at virtuozzo.com>
---
 include/linux/skbuff.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fd8e26d..eef76c3 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2440,7 +2440,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi,
 static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
 					     unsigned int length)
 {
-	return __napi_alloc_skb(napi, length, GFP_ATOMIC);
+	return __napi_alloc_skb(napi, length, GFP_ATOMIC | __GFP_NOWARN);
 }
 void napi_consume_skb(struct sk_buff *skb, int budget);
 
-- 
1.8.3.1



More information about the Devel mailing list