Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp211441ybm; Mon, 20 May 2019 14:48:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjjK5/7kAJMFEtm1EOcl3Cbsc0OwZofTRQm4IC1ZZVMSkubmcI0XYzz196blgr7G6a6FrH X-Received: by 2002:a17:902:e583:: with SMTP id cl3mr79039511plb.35.1558388922093; Mon, 20 May 2019 14:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558388922; cv=none; d=google.com; s=arc-20160816; b=H+4z6SqLC2ZfgUXdmJBThzVEM+jI5rp0fhFjUAScIGDEKHvYmrlYouZz9b4bieA4x3 Nd/tsWJTSDM0RxiiOLiANNslyKSDNd+y58iYOgh9WmvYRamW9B9gQby+FvFGTrYFgp8C flq0o72XFH+hZq2PD3EVBfX5r8u4JXQB/La+WROrK5tl5+FFmPeAvqzoZ4P91P/y/Ps2 1ou4RDaGDa5rXGLdTiCyW7sWEODKR9sElQ0iffj57DE2pRloIerlFE63dNpmUUI+s5ll vIgVDWb4kVQIlcuGBzgJ3zqVss2sEnpvzPBaTRKvrmHfLMOLrEcitlCWTaGC8Up/Tahx g3Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YUHf7q9iXWCEikBJqRLDYPHkxe+K1g9F0jzW6WB16Gw=; b=EDrB1n7gNLhVzpnj46QONEnJ/jxbaD2WLFUpx5AkblaxSJXyrm1SqVQEat54ZmJbKw qPPe9aweG/2q0owg+pI+aC0/koiM0EgbUxjeW4id01oY27COR3ex3RhMVIJW74OG1z8M 244TaRMzK9w4qwrYtdyMTaT4oisZzuR6N3rE+nJDe366xn80vQJZ4r84xYiJj3kiL8Vh ZrH36CG9p32dz7UFwZ8aDbiiX86QPHB1iZPtzJBwjfYNHSYkmKjWEwN5T7FdNQQJ4k3T x7WHhrqf4/24RxfDg3JcUWo4K9exvnLOyrQErG/X608+QP/+laN6c/r+VXwZckUWgcGL RVFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SqzGa+39; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h25si20014343pfn.209.2019.05.20.14.48.26; Mon, 20 May 2019 14:48:42 -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=@chromium.org header.s=google header.b=SqzGa+39; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727058AbfETVpc (ORCPT + 99 others); Mon, 20 May 2019 17:45:32 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33381 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbfETVp3 (ORCPT ); Mon, 20 May 2019 17:45:29 -0400 Received: by mail-pg1-f194.google.com with SMTP id h17so7421536pgv.0 for ; Mon, 20 May 2019 14:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YUHf7q9iXWCEikBJqRLDYPHkxe+K1g9F0jzW6WB16Gw=; b=SqzGa+39RXJrEiK/aoV7RYVpMOaf6+ADD2GKSHjU5EM9Ck0hSAnWM8ba4z4W+qf3yW h5WCMgI9wyUBhVx7XvvC2hBF+aqmsrvvAM9tp/XVqYg9PfsayruOhj7Ef2Ar9EfT8Y9/ GDU5QBHSyO9SMMRWu0IcsnnuCMUPLv0WRWae8= 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=YUHf7q9iXWCEikBJqRLDYPHkxe+K1g9F0jzW6WB16Gw=; b=mChHvh1R7TA+80BRkezQ7tuDhPId3peo9tNUyb1ih3W6F+D58fHhZMTy1uiWiTI6ne c4djOBZK7CBQIsRdLAaWeV5Qo+rvNlOm+N4uzFTnFXSN+fIXXKVFG38pjmR4ZeXe+xbx pvGn6q2/Mr5KosWxe43uIkMFjQQVOGNsrWtLSWYSM+BUR5CRmk56J4Ai0knFdf+G6SMR 11LwoUgY+kShC7+Oe60XjQ3gFo8/lb2GYwomJXjuIegQMAE/THWPWLtPrw7hG46GvlHA H+Iv1AyTvM49VB+jTHgj2O+QoQaoButWxI+MFbekQ4MrOvu6ZEBNhxCnS710nRBwzKYP PIdQ== X-Gm-Message-State: APjAAAV9StLIZREq7C7d6n1D2YDl47AixmxcyNCVizkbrJkgA3SxulXG t9ktutKwlBQd2zwppw18DFD1aA== X-Received: by 2002:a63:2248:: with SMTP id t8mr34282895pgm.358.1558388728012; Mon, 20 May 2019 14:45:28 -0700 (PDT) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id d186sm27681331pfd.183.2019.05.20.14.45.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 14:45:27 -0700 (PDT) From: Nicolas Boichat To: Andrew Morton Cc: David Rientjes , Nicolas Boichat , Michal Hocko , Joe Perches , Greg Kroah-Hartman , linux-mm@kvack.org, Akinobu Mita , Pekka Enberg , Mel Gorman , linux-kernel@vger.kernel.org Subject: [PATCH v2] mm/failslab: By default, do not fail allocations with direct reclaim only Date: Tue, 21 May 2019 05:45:14 +0800 Message-Id: <20190520214514.81360-1-drinkcat@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When failslab was originally written, the intention of the "ignore-gfp-wait" flag default value ("N") was to fail GFP_ATOMIC allocations. Those were defined as (__GFP_HIGH), and the code would test for __GFP_WAIT (0x10u). However, since then, __GFP_WAIT was replaced by __GFP_RECLAIM (___GFP_DIRECT_RECLAIM|___GFP_KSWAPD_RECLAIM), and GFP_ATOMIC is now defined as (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM). This means that when the flag is false, almost no allocation ever fails (as even GFP_ATOMIC allocations contain ___GFP_KSWAPD_RECLAIM). Restore the original intent of the code, by ignoring calls that directly reclaim only (__GFP_DIRECT_RECLAIM), and thus, failing GFP_ATOMIC calls again by default. Fixes: 71baba4b92dc1fa1 ("mm, page_alloc: rename __GFP_WAIT to __GFP_RECLAIM") Signed-off-by: Nicolas Boichat Reviewed-by: Akinobu Mita Acked-by: David Rientjes --- mm/failslab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/failslab.c b/mm/failslab.c index ec5aad211c5be97..f92fed91ac2360a 100644 --- a/mm/failslab.c +++ b/mm/failslab.c @@ -23,7 +23,8 @@ bool __should_failslab(struct kmem_cache *s, gfp_t gfpflags) if (gfpflags & __GFP_NOFAIL) return false; - if (failslab.ignore_gfp_reclaim && (gfpflags & __GFP_RECLAIM)) + if (failslab.ignore_gfp_reclaim && + (gfpflags & __GFP_DIRECT_RECLAIM)) return false; if (failslab.cache_filter && !(s->flags & SLAB_FAILSLAB)) -- 2.21.0.1020.gf2820cf01a-goog