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 0F1C0C433EA for ; Fri, 17 Jul 2020 08:35:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC68020704 for ; Fri, 17 Jul 2020 08:35:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC68020704 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 77AA48D0001; Fri, 17 Jul 2020 04:35:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72E986B0029; Fri, 17 Jul 2020 04:35:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 668A28D0001; Fri, 17 Jul 2020 04:35:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id 504116B0028 for ; Fri, 17 Jul 2020 04:35:32 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 118D11CB1E for ; Fri, 17 Jul 2020 08:35:32 +0000 (UTC) X-FDA: 77046908904.28.mine80_0e105fb26f09 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 136111C96E for ; Fri, 17 Jul 2020 08:33:42 +0000 (UTC) X-HE-Tag: mine80_0e105fb26f09 X-Filterd-Recvd-Size: 3728 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jul 2020 08:33:41 +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 238E9AFF1; Fri, 17 Jul 2020 08:10:11 +0000 (UTC) Subject: Re: [PATCH 1/4] mm/page_alloc: fix non cma alloc context 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> From: Vlastimil Babka Message-ID: <5a8b13d5-da40-7b1b-2968-e6701001cc0e@suse.cz> Date: Fri, 17 Jul 2020 10:10:05 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Queue-Id: 136111C96E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 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:4= 5, 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 al= locate >> >> > * a page. >> >> > @@ -3706,6 +3714,8 @@ get_page_from_freelist(gfp_t gfp_mask, unsi= gned 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 in= the >> >> fastpath, if that's what you wanted to avoid. >> > >> > I want to execute it on the fastpath, too. Reason that I moved it he= re >> > 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 ap= ply >> > this option to all the allocation paths at once. >> >> But get_page_from_freelist() might be called multiple times in the slo= wpath, and >> also anyone looking for gfp and alloc flags setup will likely not exam= ine this >> function. I don't see a problem in having it in two places that alread= y 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(). Hm the check below should also work for ALLOC_OOM|ALLOC_NOCMA then. /* 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; Maybe it's simpler to change get_page_from_freelist() then. But document = well. > Thanks. >=20