Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4717464yba; Wed, 10 Apr 2019 03:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyo7bVoM1J7QQHo+GDJVy5SkU4pv0gl0icCy70aBHYg1HbYS2i7NjsPt+E70XKcBWa3ap30 X-Received: by 2002:a63:2aca:: with SMTP id q193mr39880634pgq.269.1554892168081; Wed, 10 Apr 2019 03:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554892168; cv=none; d=google.com; s=arc-20160816; b=VQmk62I877nftsbziiwT7oRn1k4cF/HcyyCEe1Ht/hgw6xjM48ph34+r4DN6Uo0SXK R3RYSvH48QzgDAx5t57ADILm3qgVifZZxOm8igkESKP32T60bkPKYYX3MBw/bLYYhuy7 ykn3DvrdC75A3R6R3l5aM8C4Z20SxfeGWJHobMsicmLKRwZcG+i91fpZM+Tv2ApZjqdu 9iSAf5EKRiFIUkba5+Si5dYUFkT6HWSf0PStd2OesEOSzCz24XEOWpv8CejJlTjuo1pB iz+WImgTp5zDu60SqGtLkB6aNToixhtQtcJLLHIkZN2porG6AqtgYTC3lctaCh34pBlX uZMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=vI7ruPzpUPREcaOqSaDKx5BAPKGyNixmHz5zVAr3Sf8=; b=gbz302EVqgGVz6o0bPPpx+79bLR68cWml9xbBL9GmRUO54wQQJ9vsEw8wWXrOvhbzn LOZ4t+R3j199ri5tHi35Re5q5oCs0NlZp6HmkbGgVT1vNOBhAqO1T+t7pmqlBGHjBnwI ti+//T09TnCDlgVwtJg6hBpbdv+8dhMHv4zdl7RHhU/fPmfaCQuVdRjd9Qr/dlRZVwjT sR5bVXltZgZUqSMT7CkxdvvH/+bBRqShm/zvtXs+/5CZkG0Qaj0GWhvxtXVK5LXTIXHF VtAzuxmpa8I4XnJK0u04VSnNeQCw3Rwl13gDFo2yR6cIVTc8gHiFIhUdOM9DrAgwvM0x 6xGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foreca.com header.s=google header.b=IOjE0o+c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si29686583pll.73.2019.04.10.03.29.12; Wed, 10 Apr 2019 03:29:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@foreca.com header.s=google header.b=IOjE0o+c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730386AbfDJKUT (ORCPT + 99 others); Wed, 10 Apr 2019 06:20:19 -0400 Received: from mail-wr1-f100.google.com ([209.85.221.100]:33672 "EHLO mail-wr1-f100.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727057AbfDJKUT (ORCPT ); Wed, 10 Apr 2019 06:20:19 -0400 Received: by mail-wr1-f100.google.com with SMTP id q1so2294825wrp.0 for ; Wed, 10 Apr 2019 03:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foreca.com; s=google; h=from:to:cc:subject:date:message-id; bh=vI7ruPzpUPREcaOqSaDKx5BAPKGyNixmHz5zVAr3Sf8=; b=IOjE0o+ceSAIkYociAOManH3puI7rMgMPkkGDYLpwFDaC0GyT3GBfCoUzoyabnWyXu YSTnYpJtcrCPxSdW3yLm28HMQxEuHPYEXuz+LUWA6KOMWqCZ3gdnu1qIPJ64OccBfjwl 6sduuClhbt5McHr7Y+PC4CKCg3WuAfVEOEx0c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vI7ruPzpUPREcaOqSaDKx5BAPKGyNixmHz5zVAr3Sf8=; b=pkM/a7j/GJZkcEwiPrcrNP+Gn+AFfW4kjUhMjNm5Lhmq3VkMNMZ56jDOhYnVS1ZW6W HzZQMqgABJ3xKeXztT6o5e8WYx72ZbgViPjeoOe4U41K9pbr4IdzcKAm/+DKX0JQehk7 H65y7WV7Vr5BkRbYjXPc730RoiNu8VC/5upy3P70yEztOvGkk0dbXWfWSCmaW0SvtJPj AIa0Yh/dnMYC2mo2z6FZepLQbN+2ZiGrw5eSpjGI9eUjtaRHkI/BKH71wy9uV4IUCqzg xQgpqEoQkqsi3IsVkUAJPHQ+Ol+01tLzUAfZi+UczQuEIGtZBrOBAdj4XsMdFlxkBSXN HaTQ== X-Gm-Message-State: APjAAAXzQH/O2kNl2491gFLqhdziGr2J/ssKbKlNp0cYvkMSMrinVodd vfpeEZYb8mVt1zJgIBxf2hvOXoGLfPhfMQpsRGKGbVOsQmh6BQ== X-Received: by 2002:adf:dbce:: with SMTP id e14mr27277330wrj.249.1554891617325; Wed, 10 Apr 2019 03:20:17 -0700 (PDT) Received: from juhisz240.foreca.com ([62.209.167.158]) by smtp-relay.gmail.com with ESMTP id u16sm726155wri.12.2019.04.10.03.20.16; Wed, 10 Apr 2019 03:20:17 -0700 (PDT) X-Relaying-Domain: foreca.com From: Juha-Matti Tilli To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: juha-matti.tilli@foreca.com, Eric Dumazet , Rafael Aquini , Murphy Zhou , Yongcheng Yang , Jianhong Yin Subject: [PATCH] net: add big honking pfmemalloc OOM warning Date: Wed, 10 Apr 2019 13:19:47 +0300 Message-Id: <20190410101947.8603-1-juha-matti.tilli@foreca.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Eric Dumazet Cc: Rafael Aquini Cc: Murphy Zhou Cc: Yongcheng Yang Cc: Jianhong Yin --- 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