From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 425B5C433E0 for ; Tue, 9 Jun 2020 02:02:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE8F92078B for ; Tue, 9 Jun 2020 02:02:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HIGagLQC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE8F92078B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C2796B0002; Mon, 8 Jun 2020 22:02:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 273EA6B0005; Mon, 8 Jun 2020 22:02:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 189CA6B0006; Mon, 8 Jun 2020 22:02:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 026506B0002 for ; Mon, 8 Jun 2020 22:01:59 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B610E3570 for ; Tue, 9 Jun 2020 02:01:59 +0000 (UTC) X-FDA: 76908022758.22.tank58_1a05e3926dbe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 9490918038E6B for ; Tue, 9 Jun 2020 02:01:59 +0000 (UTC) X-HE-Tag: tank58_1a05e3926dbe X-Filterd-Recvd-Size: 4737 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Jun 2020 02:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xQwYm+5vJciSaD8wQ9QiGWO9hz7FxvM1PEcw2aR/1YI=; b=HIGagLQCEvf0AcfMAe6fq55t+F C1EdJRd+kiZcBd3xCzmuiUzNPXdXBBG7QEVV097YMUmSgb+U9G6yhmyMrK0zgiDCRhaw2RDfDz7F9 Utrfi+wtXvaoiWXt1RBTkeFcBtbOKAczCuQumywLj2pxwszil0jlMIiVhw2sr3w4vMuSfj8Bp7be+ 73RUz1/37lQmNvL0jnH4wPRwcfyFkUuuDXLEKDdQSOtCUdH9n5bh8SfaHg8PBfv9FyRiofBbaRrVG g/NxX5lS34V8sSbuP3H3GUGdok2MnjgG7/fefwX14aMAfDNhzS4FbKGNQpXqG90wwltZ4KNfg0DaD V6CfqyrA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiTaI-0004Xa-Na; Tue, 09 Jun 2020 02:01:50 +0000 Date: Mon, 8 Jun 2020 19:01:50 -0700 From: Matthew Wilcox To: Hugh Dickins Cc: Vlastimil Babka , Chris Murphy , Linux Memory Management List , Chris Wilson Subject: Re: 5.7.0 page allocation failure: order:0, mode:0x400d0 Message-ID: <20200609020150.GY19604@bombadil.infradead.org> References: <20200606151254.GO19604@bombadil.infradead.org> <20200608114445.GT19604@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 9490918038E6B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: On Mon, Jun 08, 2020 at 02:33:08PM -0700, Hugh Dickins wrote: > On Mon, 8 Jun 2020, Matthew Wilcox wrote: > > On Mon, Jun 08, 2020 at 11:08:33AM +0200, Vlastimil Babka wrote: > > > * Fail silently without starting the shrinker > > > noreclaim = mapping_gfp_constraint(mapping, ~__GFP_RECLAIM); > > > noreclaim |= __GFP_NORETRY | __GFP_NOWARN; > > > > > > possibly mapping has GFP_KERNEL, but this removes the GFP_RECLAIM part and adds > > > __GFP_NORETRY | __GFP_NOWARN > > > > > > if this fails (silently) there's a fallback > > > > > > But when this reaches __read_swap_cache_async() it does: > > > > > > /* May fail (-ENOMEM) if XArray node allocation failed. */ > > > err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL); > > > > Yes, it seems to me that the problem is that i915 set GFP_NOWARN and > > swap_state removed it. It's been this way since 2008 when Hugh committed > > f000944d03a5 > > > > I wouldn't have a problem with turning that '& GFP_KERNEL' into > > '& GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY'. > > Yes, I'd be fine with that too (with some parentheses perhaps). > > Or (looking at what you used in __add_to_page_cache_locked()), > would "gfp_mask & GFP_RECLAIM_MASK" be better? I think so, > and guess you'd be glad to follow your own precedent. Oh, again, I just moved code around. Even though I did put it in __add_to_page_cache_locked() with commit abc1be13fd11, I just moved it from pagecache_get_page(). The real hero here is commit 45f87de57f8f from Michael Hocko with honourable mention to commit dd56b0464267 by Mel Gorman. I always like to follow the precedent set in other places, and GFP_RECLAIM_MASK is exactly intended for this purpose. So yes, I think this is the perfect patch. > Quiz question: where would you expect GFP_RECLAIM_MASK to be defined? Heh. I don't think mm/internal.h is the right place for it either. I'd've put it in linux/gfp.h. > --- 5.7.0/mm/swap_state.c 2020-05-31 16:49:15.000000000 -0700 > +++ linux/mm/swap_state.c 2020-06-08 14:27:38.211813658 -0700 > @@ -23,6 +23,7 @@ > #include > > #include > +#include "internal.h" > > /* > * swapper_space is a fiction, retained to simplify the path through > @@ -418,7 +419,8 @@ struct page *__read_swap_cache_async(swp > /* May fail (-ENOMEM) if XArray node allocation failed. */ > __SetPageLocked(new_page); > __SetPageSwapBacked(new_page); > - err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL); > + err = add_to_swap_cache(new_page, entry, > + gfp_mask & GFP_RECLAIM_MASK); > if (likely(!err)) { > /* Initiate read into locked page */ > SetPageWorkingset(new_page); > Reviewed-by: Matthew Wilcox (Oracle)