Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1799720ybh; Fri, 17 Jul 2020 01:10:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygcP/dNyFhGQ8JPz9X0dkcNAmGotBn67ZVfzzY4l2WxP0GPXIRaACZCaWFaoxajJlY0CXv X-Received: by 2002:a17:906:1d5b:: with SMTP id o27mr7919178ejh.367.1594973442529; Fri, 17 Jul 2020 01:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594973442; cv=none; d=google.com; s=arc-20160816; b=OZXb5WHvTnUpjF4b27tmZLcR/Ga6Jx/0b0magKr9+AuKyNEAnb90UZh4qr5Kvbv/S9 G/70JKE33MrhvbIj9Q33s3ldhW+3A0/v+E3P0Uix5yYTNbuV5MvUJTLbYsjPrsHkrZvs 8MQiNQhaGRBPLK5PFZEh+1T0kt+amEhFTQKSf5KBx011aTrdsy05eG+237prP7nt5+3H ku/JRvV4hfee8a402gWR/vZHtLaklyBNBS35kqfHCjXgPs4wTub7b77Y4pem9gXT/g8M xxBiRokWnaAB00VyBA3lEmgIAp3+KTduDbgd2Vpk+eADzyKBlKyTt8Hy6p0xk7pyu95T 8vMg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=DNWgRJj+D7XUZFUxX0J8HgC1WFQofQdn70GORC0immg=; b=O9zWPNrOgHqu0RZL2G4eN5awH9jfx5yYu8D0TZq/oVlAG714CF6ECeJtNznjrEUPYm 4GB/p88gi3a0FiNjm6UEL0BU7gduPD09J2WOdXEBs4P0aU8EueHTZVPKYTAJigbt+lN3 iCCUzFTTaOffgcZzO/tQzXCueaH5f3wrKojKQo6gW8ShKksUchbgSZamIuvN4Fswfg/v SEaIMSxP7Q63b0trqY55J3BXhKJq5L6UKjUYJxC3fU06YyWgP9AFP1rcNKnNoQVHlYXE dCNwVKMBLySmxSBydNw2wLxDcqj+z+sjGC4J8cwQlPPuGrNo1jwZ5M+vYlrkynpF0b9T fArA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss14si234512ejb.732.2020.07.17.01.10.19; Fri, 17 Jul 2020 01:10:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727046AbgGQIKJ (ORCPT + 99 others); Fri, 17 Jul 2020 04:10:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:51884 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726113AbgGQIKI (ORCPT ); Fri, 17 Jul 2020 04:10:08 -0400 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/17/20 9:29 AM, Joonsoo Kim wrote: > 2020년 7월 16일 (목) 오후 4:45, Vlastimil Babka 님이 작성: >> >> On 7/16/20 9:27 AM, Joonsoo Kim wrote: >> > 2020년 7월 15일 (수) 오후 5:24, Vlastimil Babka 님이 작성: >> >> > /* >> >> > * get_page_from_freelist goes through the zonelist trying to allocate >> >> > * a page. >> >> > @@ -3706,6 +3714,8 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, >> >> > struct pglist_data *last_pgdat_dirty_limit = 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 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 slowpath, 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 deal >> with alloc_flags setup, as it is now. > > 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 == ALLOC_OOM || (gfp_mask & __GFP_NOMEMALLOC))) goto nopage; Maybe it's simpler to change get_page_from_freelist() then. But document well. > Thanks. >