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

Submitted by Oleg Babin on March 13, 2018, 12:24 p.m.

Details

Message ID 1520943867-3239-1-git-send-email-obabin@virtuozzo.com
State New
Series "napi: Suppress warnings on memory allocation failure."
Headers show

Commit Message

Oleg Babin March 13, 2018, 12:24 p.m.
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@virtuozzo.com>
---
 include/linux/skbuff.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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);
 

Comments

Kirill Tkhai March 13, 2018, 12:26 p.m.
On 13.03.2018 15:24, Oleg Babin wrote:
> 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@virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai@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);
>  
>