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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 463F9C433E1 for ; Fri, 17 Jul 2020 08:20:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E747F2071A for ; Fri, 17 Jul 2020 08:20:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E747F2071A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8949F8D000D; Fri, 17 Jul 2020 04:20:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84C668D0001; Fri, 17 Jul 2020 04:20:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70CB78D000D; Fri, 17 Jul 2020 04:20:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by kanga.kvack.org (Postfix) with ESMTP id 53A378D0001 for ; Fri, 17 Jul 2020 04:20:57 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 143DB1811E9E3 for ; Fri, 17 Jul 2020 08:20:57 +0000 (UTC) X-FDA: 77046872154.08.name82_2f0fdbd26f09 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 89DD218089547 for ; Fri, 17 Jul 2020 08:20:48 +0000 (UTC) X-HE-Tag: name82_2f0fdbd26f09 X-Filterd-Recvd-Size: 4089 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jul 2020 08:20:20 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A7952AFF7; Fri, 17 Jul 2020 08:15:08 +0000 (UTC) Subject: Re: [PATCH 1/4] mm/page_alloc: fix non cma alloc context From: Vlastimil Babka To: Joonsoo Kim Cc: Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko , "Aneesh Kumar K . V" , Joonsoo Kim , stable@vger.kernel.org References: <1594789529-6206-1-git-send-email-iamjoonsoo.kim@lge.com> <332d620b-bfe3-3b69-931b-77e3a74edbfd@suse.cz> <6f18d999-4518-31ce-4cea-9b5b89a577ad@suse.cz> <5a8b13d5-da40-7b1b-2968-e6701001cc0e@suse.cz> Message-ID: Date: Fri, 17 Jul 2020 10:15:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5a8b13d5-da40-7b1b-2968-e6701001cc0e@suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Queue-Id: 89DD218089547 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 Content-Transfer-Encoding: quoted-printable 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 7/17/20 10:10 AM, Vlastimil Babka wrote: > On 7/17/20 9:29 AM, Joonsoo Kim wrote: >> 2020=EB=85=84 7=EC=9B=94 16=EC=9D=BC (=EB=AA=A9) =EC=98=A4=ED=9B=84 4:= 45, Vlastimil Babka =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1= : >>> >>> On 7/16/20 9:27 AM, Joonsoo Kim wrote: >>> > 2020=EB=85=84 7=EC=9B=94 15=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84= 5:24, Vlastimil Babka =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84= =B1: >>> >> > /* >>> >> > * get_page_from_freelist goes through the zonelist trying to a= llocate >>> >> > * a page. >>> >> > @@ -3706,6 +3714,8 @@ get_page_from_freelist(gfp_t gfp_mask, uns= igned int order, int alloc_flags, >>> >> > struct pglist_data *last_pgdat_dirty_limit =3D NULL; >>> >> > bool no_fallback; >>> >> > >>> >> > + current_alloc_flags(gfp_mask, &alloc_flags); >>> >> >>> >> I don't see why to move the test here? It will still be executed i= n the >>> >> fastpath, if that's what you wanted to avoid. >>> > >>> > I want to execute it on the fastpath, too. Reason that I moved it h= ere >>> > is that alloc_flags could be reset on slowpath. See the code where >>> > __gfp_pfmemalloc_flags() is on. This is the only place that I can a= pply >>> > this option to all the allocation paths at once. >>> >>> But get_page_from_freelist() might be called multiple times in the sl= owpath, and >>> also anyone looking for gfp and alloc flags setup will likely not exa= mine this >>> function. I don't see a problem in having it in two places that alrea= dy deal >>> with alloc_flags setup, as it is now. >>=20 >> I agree that anyone looking alloc flags will miss that function easily= . Okay. >> I will place it on its original place, although we now need to add one >> more place. >> *Three places* are gfp_to_alloc_flags(), prepare_alloc_pages() and >> __gfp_pfmemalloc_flags(). >=20 > Hm the check below should also work for ALLOC_OOM|ALLOC_NOCMA then. >=20 > /* Avoid allocations with no watermarks from looping endlessly */ > if (tsk_is_oom_victim(current) && > (alloc_flags =3D=3D ALLOC_OOM || > (gfp_mask & __GFP_NOMEMALLOC))) > goto nopage; >=20 > Maybe it's simpler to change get_page_from_freelist() then. But documen= t well. But then we have e.g. should_reclaim_retry() which calls __zone_watermark= _ok() where ALLOC_CMA plays a role too, so that means we should have alloc_mask= set up correctly wrt ALLOC_CMA at the __alloc_pages_slowpath() level... >> Thanks. >>=20 >=20