From patchwork Mon Oct 28 19:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 11216329 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 044DA112B for ; Mon, 28 Oct 2019 19:49:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C0F74217D6 for ; Mon, 28 Oct 2019 19:49:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="UVWgsN7M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0F74217D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B37206B0005; Mon, 28 Oct 2019 15:49:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AF0466B0006; Mon, 28 Oct 2019 15:49:10 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ADDB6B0007; Mon, 28 Oct 2019 15:49:10 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 734306B0005 for ; Mon, 28 Oct 2019 15:49:10 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 0D0296135 for ; Mon, 28 Oct 2019 19:49:10 +0000 (UTC) X-FDA: 76094232060.01.leaf29_15b93a118a740 X-Spam-Summary: 2,0,0,498b3a781cb74557,d41d8cd98f00b204,hannes@cmpxchg.org,:akpm@linux-foundation.org::linux-kernel@vger.kernel.org:kernel-team@fb.com,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:2892:2899:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4385:4433:4605:5007:6261:6653:9592:10004:11026:11233:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13161:13191:13192:13229:13311:13357:13894:14096:14181:14384:14394:14721:14777:21067:21080:21444:21451:21627:30054:30075,0,RBL:209.85.160.196:@cmpxchg.org:.lbl8.mailshell.net-62.14.0.100 66.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:34,LUA_SUMMARY:none X-HE-Tag: leaf29_15b93a118a740 X-Filterd-Recvd-Size: 4762 Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Mon, 28 Oct 2019 19:49:09 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id l3so5887453qtp.2 for ; Mon, 28 Oct 2019 12:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dLsRzU9RkO90ampJ/ozomhEJBGNXuMvmD2GIBvPi1PE=; b=UVWgsN7MDJBDqZEC/aH7j8f4kdFYvqLrpU5YPyhYkH65DL0OwJpjqIgM0CqEPEliug qf+qD7H2gUe2WTYiJyhqmoGkTHLgO868gW4I2UuZBv9HtpROn0wr6tjYFO9yDmDRT56L eysXr6MnwGteSIKg9RMiOPw1T1/6FAA+1m9lbot8CZETjyNNZz5bRKddYL9h+3QDAyWu dWtqcTGfel6j6VgVjeJRr9FJ3rpd+cvf4foy8Kb0ViGgbO4a9v/H1tDemW0z5c3Ktv9X gYQBkCcPJwa5ip9mUlZOf9ZYP9f0xiIVoS2pZvNymR1Pdsz2h0jl2atZejkvUw+evSuM 9kUA== 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:mime-version :content-transfer-encoding; bh=dLsRzU9RkO90ampJ/ozomhEJBGNXuMvmD2GIBvPi1PE=; b=kdliZy1Bt9xJekC7haWa7DyBpDx1qw+fBhYmjD3xi1KUqtYWTeBIcrnFfB8VhxHA3Y VESxhFDo+D7VOECT/gtLjIsi4TM9gZ+OvBEjXJ9c1tr0szrImsewWLDs1Jgc6BLqRJxA yk++oKwKdhIXsA1zVhzvUfsn789d4hvY5a0N34povrJZzU3slvm07WxDP8K8yHAfQZC4 VSB3P/MPDZ38xSljLbS/JwhfzXvUYUCGtfNBlRebdXm7C/dkK1uu+XFgGIuPmsfH5nsL dEc+8M54zU18IWgZPvrbgtrg5ZhMjQ3oa6oCLmqy3LFiqm96sexxcHNjwnroxj+nVwWT Bz/Q== X-Gm-Message-State: APjAAAVkJ+WbME9TfFRpmWfo3eGxsObcXVc17dWHSQJ4eNsrkJLKuvbt +sPlS37eJc1+BEFFCUHRBz7QGg== X-Google-Smtp-Source: APXvYqxW0JuhBdSHqh1EzJLwHZde1whPR3+3jW8HLxrMtoXyA45o/FcdwwOyaVNavQityBmUQSA4Ug== X-Received: by 2002:ac8:75c2:: with SMTP id z2mr201363qtq.216.1572292148163; Mon, 28 Oct 2019 12:49:08 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::2:831b]) by smtp.gmail.com with ESMTPSA id q34sm8099967qte.50.2019.10.28.12.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 12:49:07 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] mm: rate-limit allocation failure warnings more aggressively Date: Mon, 28 Oct 2019 15:49:06 -0400 Message-Id: <20191028194906.26899-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: While investigating a bug related to higher atomic allocation failures, we noticed the failure warnings positively drowning the console, and in our case trigger lockup warnings because of a serial console too slow to handle all that output. But even if we had a faster console, it's unclear what additional information the current level of repetition provides. Allocation failures happen for three reasons: The machine is OOM, the VM is failing to handle reasonable requests, or somebody is making unreasonable requests (and didn't acknowledge their opportunism with __GFP_NOWARN). Having the memory dump, a callstack, and the ratelimit stats on skipped failure warnings should provide enough information to let users/admins/developers know whether something is wrong and point them in the right direction for debugging, bpftracing etc. Limit allocation failure warnings to 1 spew every ten seconds. Signed-off-by: Johannes Weiner Acked-by: David Rientjes --- mm/page_alloc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 791c018314b3..f412b17b5d59 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3720,10 +3720,6 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask) { unsigned int filter = SHOW_MEM_FILTER_NODES; - static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1); - - if (!__ratelimit(&show_mem_rs)) - return; /* * This documents exceptions given to allocations in certain @@ -3744,8 +3740,7 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...) { struct va_format vaf; va_list args; - static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL, - DEFAULT_RATELIMIT_BURST); + static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) return;