All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: siyanteng@loongson.cn, netdev@vger.kernel.org,
	alexandre.torgue@foss.st.com, edumazet@google.com,
	joabreu@synopsys.com, anthony.l.nguyen@intel.com,
	mcoquelin.stm32@gmail.com, intel-wired-lan@lists.osuosl.org,
	pabeni@redhat.com, davem@davemloft.net, alexs@kernel.org
Subject: Re: [Intel-wired-lan] [PATCH net-next] net: remove gfp_mask from napi_alloc_skb()
Date: Tue, 26 Mar 2024 10:56:47 +0100	[thread overview]
Message-ID: <c2ef8ae6-d813-424b-9c8d-1cb76bb62652@intel.com> (raw)
In-Reply-To: <20240325224116.2585741-1-kuba@kernel.org>

From: Jakub Kicinski <kuba@kernel.org>
Date: Mon, 25 Mar 2024 15:41:14 -0700

> __napi_alloc_skb() is napi_alloc_skb() with the added flexibility
> of choosing gfp_mask. This is a NAPI function, so GFP_ATOMIC is
> implied. The only practical choice the caller has is whether to
> set __GFP_NOWARN. But that's a false choice, too, allocation failures
> in atomic context will happen, and printing warnings in logs,
> effectively for a packet drop, is both too much and very likely
> non-actionable.
> 
> This leads me to a conclusion that most uses of napi_alloc_skb()
> are simply misguided, and should use __GFP_NOWARN in the first
> place. We also have a "standard" way of reporting allocation
> failures via the queue stat API (qstats::rx-alloc-fail).
> 
> The direct motivation for this patch is that one of the drivers
> used at Meta calls napi_alloc_skb() (so prior to this patch without
> __GFP_NOWARN), and the resulting OOM warning is the top networking
> warning in our fleet.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Nice cleanup!

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

> ---
> This is changing mostly the Intel drivers, if the choice of
> flags is important there, please do let me know, why IDPF
> uses bare GFP_ATOMIC, specifically.

idpf uses bare atomic w/o nowarn because the author didn't pay attention
to it. The change is totally safe.

Thanks,
Olek

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>, <alexs@kernel.org>,
	<siyanteng@loongson.cn>, <jesse.brandeburg@intel.com>,
	<anthony.l.nguyen@intel.com>, <alexandre.torgue@foss.st.com>,
	<joabreu@synopsys.com>, <mcoquelin.stm32@gmail.com>,
	<intel-wired-lan@lists.osuosl.org>
Subject: Re: [PATCH net-next] net: remove gfp_mask from napi_alloc_skb()
Date: Tue, 26 Mar 2024 10:56:47 +0100	[thread overview]
Message-ID: <c2ef8ae6-d813-424b-9c8d-1cb76bb62652@intel.com> (raw)
In-Reply-To: <20240325224116.2585741-1-kuba@kernel.org>

From: Jakub Kicinski <kuba@kernel.org>
Date: Mon, 25 Mar 2024 15:41:14 -0700

> __napi_alloc_skb() is napi_alloc_skb() with the added flexibility
> of choosing gfp_mask. This is a NAPI function, so GFP_ATOMIC is
> implied. The only practical choice the caller has is whether to
> set __GFP_NOWARN. But that's a false choice, too, allocation failures
> in atomic context will happen, and printing warnings in logs,
> effectively for a packet drop, is both too much and very likely
> non-actionable.
> 
> This leads me to a conclusion that most uses of napi_alloc_skb()
> are simply misguided, and should use __GFP_NOWARN in the first
> place. We also have a "standard" way of reporting allocation
> failures via the queue stat API (qstats::rx-alloc-fail).
> 
> The direct motivation for this patch is that one of the drivers
> used at Meta calls napi_alloc_skb() (so prior to this patch without
> __GFP_NOWARN), and the resulting OOM warning is the top networking
> warning in our fleet.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Nice cleanup!

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

> ---
> This is changing mostly the Intel drivers, if the choice of
> flags is important there, please do let me know, why IDPF
> uses bare GFP_ATOMIC, specifically.

idpf uses bare atomic w/o nowarn because the author didn't pay attention
to it. The change is totally safe.

Thanks,
Olek

  reply	other threads:[~2024-03-26  9:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 22:41 [Intel-wired-lan] [PATCH net-next] net: remove gfp_mask from napi_alloc_skb() Jakub Kicinski
2024-03-25 22:41 ` Jakub Kicinski
2024-03-26  9:56 ` Alexander Lobakin [this message]
2024-03-26  9:56   ` Alexander Lobakin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2ef8ae6-d813-424b-9c8d-1cb76bb62652@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexs@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=siyanteng@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.