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,URIBL_BLOCKED,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 7A2C2C433E7 for ; Thu, 16 Jul 2020 07:46:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28C59206F4 for ; Thu, 16 Jul 2020 07:46:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28C59206F4 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 936818D0001; Thu, 16 Jul 2020 03:46:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BE896B000D; Thu, 16 Jul 2020 03:46:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 785748D0001; Thu, 16 Jul 2020 03:46:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 5E9D96B0007 for ; Thu, 16 Jul 2020 03:46:01 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E4B1A2DFA for ; Thu, 16 Jul 2020 07:46:00 +0000 (UTC) X-FDA: 77043155280.02.twig52_61079d926f00 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 90B0750001B5FB98 for ; Thu, 16 Jul 2020 07:46:00 +0000 (UTC) X-HE-Tag: twig52_61079d926f00 X-Filterd-Recvd-Size: 3892 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jul 2020 07:46:00 +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 62992ABF4; Thu, 16 Jul 2020 07:46:02 +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> From: Vlastimil Babka Message-ID: <6f18d999-4518-31ce-4cea-9b5b89a577ad@suse.cz> Date: Thu, 16 Jul 2020 09:45:55 +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: 90B0750001B5FB98 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/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:2= 4, Vlastimil Babka =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: >> > /* >> > * get_page_from_freelist goes through the zonelist trying to alloc= ate >> > * a page. >> > @@ -3706,6 +3714,8 @@ get_page_from_freelist(gfp_t gfp_mask, unsigne= d 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 th= e >> fastpath, if that's what you wanted to avoid. >=20 > I want to execute it on the fastpath, too. Reason that I moved it here > 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 apply > this option to all the allocation paths at once. But get_page_from_freelist() might be called multiple times in the slowpa= th, and also anyone looking for gfp and alloc flags setup will likely not examine= this function. I don't see a problem in having it in two places that already d= eal with alloc_flags setup, as it is now. > Thanks. >=20 >> > + >> > retry: >> > /* >> > * Scan zonelist, looking for a zone with enough free. >> > @@ -4339,10 +4349,6 @@ gfp_to_alloc_flags(gfp_t gfp_mask) >> > } else if (unlikely(rt_task(current)) && !in_interrupt()) >> > alloc_flags |=3D ALLOC_HARDER; >> > >> > -#ifdef CONFIG_CMA >> > - if (gfp_migratetype(gfp_mask) =3D=3D MIGRATE_MOVABLE) >> > - alloc_flags |=3D ALLOC_CMA; >> > -#endif >> >> I would just replace this here with: >> alloc_flags =3D current_alloc_flags(gfp_mask, alloc_flags); >> >> > return alloc_flags; >> > } >> > >> > @@ -4808,9 +4814,6 @@ static inline bool prepare_alloc_pages(gfp_t g= fp_mask, unsigned int order, >> > if (should_fail_alloc_page(gfp_mask, order)) >> > return false; >> > >> > - if (IS_ENABLED(CONFIG_CMA) && ac->migratetype =3D=3D MIGRATE_M= OVABLE) >> > - *alloc_flags |=3D ALLOC_CMA; >> >> And same here... Ah, I see. current_alloc_flags() should probably take= a >> migratetype parameter instead of gfp_mask then. >> >> > - >> > return true; >> > } >> > >> > >> >=20