Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1029518ybh; Thu, 16 Jul 2020 00:48:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy32En1Udk32OMCFYLbjFT94zsGpCBtGWXTf0ba032oZVVx5pLW4D/536TOiaDvqvscwwCD X-Received: by 2002:a17:906:410a:: with SMTP id j10mr2570425ejk.201.1594885736707; Thu, 16 Jul 2020 00:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594885736; cv=none; d=google.com; s=arc-20160816; b=bY8ozGT/P7SyAc5mw94ywb/KKlatbmUTteJTo36x/xYr4AXXFiI+ye7n8g+6qGHnZ3 0B3RnUeEeMQhMBymcy4myInm+c4XTsvViZnY8WdCLr0fLYtosK4AYfSeUbHvSXH4FDKA roY9hp/DE1nh15l6o4t2m3y5JaYRXap4R+bUKAFF+4U21TJwQ5oPahQqsGcqyJwQsZCo 5E95K1ELdmwLBHJ9jF1XykU5lnsw26oFEpwANtI4tDifSjbNGipgR1/FyeEVNyRJTHO0 +sgBme+iVUVCXGUWB2G3k0nAku1bmfZ/vi+AdcD30md0b4+o9skNdrwvvIcwZLMgb1qv I+ew== 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=lo4FP9O0hes5To96nnQFon5xBrxq0hrb9GDdvrLKSt0=; b=gmg1cWka1urvmW3MUtnIVmdARXVY3C6CnfU0qgAnZeDEeODh7Zitoq/VMy7K7K4azF 7g4tb4ncDsdHNeJSj0P7sIbDIIlc66IAzl+yZssEvkWNyquyI4jQK5v7nXnMMvVrxLYM 6ruNmlyT3cE9NqFGP0WYEyCwhzSkUmAJOTmz1idC0mYKgplQLmbSLOjcGpa6+nXTNsEu d7t0/OQUlIcd6K0VaC940ltR4sBJgj9OjL4iry5By4fl3VViq4adre2QU252uPgiqEd2 QP+J2Q6qyPlc0aaoE0YsrrZocBvlPU6JrKkY7F6nxjOfqsuiUXCIslmaEv0bbh0vLWeO GL3Q== 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 b17si2827755eds.439.2020.07.16.00.48.34; Thu, 16 Jul 2020 00:48:56 -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 S1726411AbgGPHqA (ORCPT + 99 others); Thu, 16 Jul 2020 03:46:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:35558 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbgGPHqA (ORCPT ); Thu, 16 Jul 2020 03:46:00 -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 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 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/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. > Thanks. > >> > + >> > 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 |= ALLOC_HARDER; >> > >> > -#ifdef CONFIG_CMA >> > - if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE) >> > - alloc_flags |= ALLOC_CMA; >> > -#endif >> >> I would just replace this here with: >> alloc_flags = current_alloc_flags(gfp_mask, alloc_flags); >> >> > return alloc_flags; >> > } >> > >> > @@ -4808,9 +4814,6 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, >> > if (should_fail_alloc_page(gfp_mask, order)) >> > return false; >> > >> > - if (IS_ENABLED(CONFIG_CMA) && ac->migratetype == MIGRATE_MOVABLE) >> > - *alloc_flags |= ALLOC_CMA; >> >> And same here... Ah, I see. current_alloc_flags() should probably take a >> migratetype parameter instead of gfp_mask then. >> >> > - >> > return true; >> > } >> > >> > >> >