netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	pabeni@redhat.com, almasrymina@google.com,
	asml.silence@gmail.com, lorenzo@kernel.org,
	bigeasy@linutronix.de, dhowells@redhat.com,
	liangchen.linux@gmail.com, aleksander.lobakin@intel.com,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 6.11 043/244] net: skbuff: sprinkle more __GFP_NOWARN on ingress allocs
Date: Wed, 25 Sep 2024 07:24:24 -0400	[thread overview]
Message-ID: <20240925113641.1297102-43-sashal@kernel.org> (raw)
In-Reply-To: <20240925113641.1297102-1-sashal@kernel.org>

From: Jakub Kicinski <kuba@kernel.org>

[ Upstream commit c89cca307b20917da739567a255a68a0798ee129 ]

build_skb() and frag allocations done with GFP_ATOMIC will
fail in real life, when system is under memory pressure,
and there's nothing we can do about that. So no point
printing warnings.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/core/skbuff.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 83f8cd8aa2d16..de2a044cc6656 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -314,8 +314,8 @@ void *__napi_alloc_frag_align(unsigned int fragsz, unsigned int align_mask)
 	fragsz = SKB_DATA_ALIGN(fragsz);
 
 	local_lock_nested_bh(&napi_alloc_cache.bh_lock);
-	data = __page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC,
-				       align_mask);
+	data = __page_frag_alloc_align(&nc->page, fragsz,
+				       GFP_ATOMIC | __GFP_NOWARN, align_mask);
 	local_unlock_nested_bh(&napi_alloc_cache.bh_lock);
 	return data;
 
@@ -330,7 +330,8 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask)
 		struct page_frag_cache *nc = this_cpu_ptr(&netdev_alloc_cache);
 
 		fragsz = SKB_DATA_ALIGN(fragsz);
-		data = __page_frag_alloc_align(nc, fragsz, GFP_ATOMIC,
+		data = __page_frag_alloc_align(nc, fragsz,
+					       GFP_ATOMIC | __GFP_NOWARN,
 					       align_mask);
 	} else {
 		local_bh_disable();
@@ -349,7 +350,7 @@ static struct sk_buff *napi_skb_cache_get(void)
 	local_lock_nested_bh(&napi_alloc_cache.bh_lock);
 	if (unlikely(!nc->skb_count)) {
 		nc->skb_count = kmem_cache_alloc_bulk(net_hotdata.skbuff_cache,
-						      GFP_ATOMIC,
+						      GFP_ATOMIC | __GFP_NOWARN,
 						      NAPI_SKB_CACHE_BULK,
 						      nc->skb_cache);
 		if (unlikely(!nc->skb_count)) {
@@ -418,7 +419,8 @@ struct sk_buff *slab_build_skb(void *data)
 	struct sk_buff *skb;
 	unsigned int size;
 
-	skb = kmem_cache_alloc(net_hotdata.skbuff_cache, GFP_ATOMIC);
+	skb = kmem_cache_alloc(net_hotdata.skbuff_cache,
+			       GFP_ATOMIC | __GFP_NOWARN);
 	if (unlikely(!skb))
 		return NULL;
 
@@ -469,7 +471,8 @@ struct sk_buff *__build_skb(void *data, unsigned int frag_size)
 {
 	struct sk_buff *skb;
 
-	skb = kmem_cache_alloc(net_hotdata.skbuff_cache, GFP_ATOMIC);
+	skb = kmem_cache_alloc(net_hotdata.skbuff_cache,
+			       GFP_ATOMIC | __GFP_NOWARN);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.43.0


  parent reply	other threads:[~2024-09-25 11:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 11:23 [PATCH AUTOSEL 6.11 001/244] l2tp: prevent possible tunnel refcount underflow Sasha Levin
2024-09-25 11:23 ` [PATCH AUTOSEL 6.11 009/244] ice: Adjust over allocation of memory in ice_sched_add_root_node() and ice_sched_add_node() Sasha Levin
2024-09-25 11:23 ` [PATCH AUTOSEL 6.11 012/244] wifi: cfg80211: Set correct chandef when starting CAC Sasha Levin
2024-09-25 11:23 ` [PATCH AUTOSEL 6.11 013/244] net/xen-netback: prevent UAF in xenvif_flush_hash() Sasha Levin
2024-09-25 11:23 ` [PATCH AUTOSEL 6.11 014/244] net: hisilicon: hip04: fix OF node leak in probe() Sasha Levin
2024-09-25 11:23 ` [PATCH AUTOSEL 6.11 015/244] net: hisilicon: hns_dsaf_mac: fix OF node leak in hns_mac_get_info() Sasha Levin
2024-09-25 11:23 ` [PATCH AUTOSEL 6.11 016/244] net: hisilicon: hns_mdio: fix OF node leak in probe() Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 022/244] e1000e: avoid failing the system during pm_suspend Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 025/244] net: sched: consistently use rcu_replace_pointer() in taprio_change() Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 036/244] l2tp: don't use tunnel socket sk_user_data in ppp procfs output Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 037/244] l2tp: free sessions using rcu Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 038/244] l2tp: use rcu list add/del when updating lists Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 042/244] tipc: guard against string buffer overrun Sasha Levin
2024-09-25 11:24 ` Sasha Levin [this message]
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 044/244] net: mvpp2: Increase size of queue_name buffer Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 045/244] bnxt_en: Extend maximum length of version string by 1 byte Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 046/244] ipv4: Check !in_dev earlier for ioctl(SIOCSIFADDR) Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 048/244] netfilter: nf_tables: do not remove elements if set backend implements .abort Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 049/244] netfilter: nf_tables: don't initialize registers in nft_do_chain() Sasha Levin
2024-09-25 11:58   ` Pablo Neira Ayuso
2024-09-25 12:17     ` Pablo Neira Ayuso
2024-09-25 12:20     ` Florian Westphal
2024-10-06  0:28       ` Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 050/244] ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 054/244] net: atlantic: Avoid warning about potential string truncation Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 056/244] netpoll: Ensure clean state on setup failures Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 057/244] tcp: avoid reusing FIN_WAIT2 when trying to find port in connect() process Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 062/244] wifi: mac80211: fix RCU list iterations Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 068/244] can: netlink: avoid call to do_set_data_bittiming callback with stale can_priv::ctrlmode Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 069/244] netdev-genl: Set extack and fix error on napi-get Sasha Levin
2024-09-25 11:24 ` [PATCH AUTOSEL 6.11 075/244] net: phy: Check for read errors in SIOCGMIIREG Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 079/244] net: napi: Prevent overflow of napi_defer_hard_irqs Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 084/244] net: tls: wait for async completion on last message Sasha Levin
2024-09-25 11:25 ` [PATCH AUTOSEL 6.11 087/244] nfp: Use IRQF_NO_AUTOEN flag in request_irq() Sasha Levin

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=20240925113641.1297102-43-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=almasrymina@google.com \
    --cc=asml.silence@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=liangchen.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).