linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: add big honking pfmemalloc OOM warning
@ 2019-04-10 10:19 Juha-Matti Tilli
  2019-04-10 14:16 ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Juha-Matti Tilli @ 2019-04-10 10:19 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: juha-matti.tilli, Eric Dumazet, Rafael Aquini, Murphy Zhou,
	Yongcheng Yang, Jianhong Yin

A system administrator is not notified (except via an obscure SNMP
counter that most sysadmins don't know to look for) if packets are
dropped due to out-of-memory condition when SKBs use pfmemalloc
reserves. This can for example lead to NFS connections hanging on
high-volume systems.

Implement a ratelimited big honking out of memory warning that directs
the sysadmin to bump up vm.min_free_kbytes in case this problem happens.
Our experience shows that with default vm.min_free_kbytes (90112, or
about 90 megabytes), NFS connections hang approximately once per day,
whereas with 901120 (default multiplied by 10) NFS connections never
hang.

Signed-off-by: Juha-Matti Tilli <juha-matti.tilli@foreca.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Murphy Zhou <xzhou@redhat.com>
Cc: Yongcheng Yang <yoyang@redhat.com>
Cc: Jianhong Yin <jiyin@redhat.com>
---
 net/core/filter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index fc92ebc4e200..7d8ef239b9af 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -99,6 +99,8 @@ int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap)
 	 * helping free memory
 	 */
 	if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC)) {
+		printk_ratelimited(KERN_WARNING
+				   "dropped packet due to out-of-memory condition, please bump up vm.min_free_kbytes\n");
 		NET_INC_STATS(sock_net(sk), LINUX_MIB_PFMEMALLOCDROP);
 		return -ENOMEM;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-11 10:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10 10:19 [PATCH] net: add big honking pfmemalloc OOM warning Juha-Matti Tilli
2019-04-10 14:16 ` Eric Dumazet
2019-04-10 15:01   ` Juha-Matti Tilli
2019-04-10 15:36     ` Eric Dumazet
2019-04-11  6:26       ` Juha-Matti Tilli
2019-04-11 10:26         ` Eric Dumazet
2019-04-10 19:11   ` David Miller
2019-04-11  6:51     ` Juha-Matti Tilli

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