Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp564348ybh; Tue, 21 Jul 2020 02:18:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwPRuvdQdIQFXOVv9bFbq7dNTr1044CAcDtrrAwwqetWcjXg4FWnVnO5WHsv/SsLxNr2sf X-Received: by 2002:a50:fa0c:: with SMTP id b12mr25457643edq.226.1595323081088; Tue, 21 Jul 2020 02:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595323081; cv=none; d=google.com; s=arc-20160816; b=sT8KoihNBMy3Gwr08GJzSom84KDC8QomT3ZtHH9C4O/5Z3neayv5QHZgFHWiSF4GrI 4tT1Ts/UMxs/1AfJUHxnBE416Uo2Iyzttq0yxPTjovZkcgjgZrksb9j22qoYySkDLXh9 tJ4aunDvoeyRSLT87rvUios+osXBzi0C0uVO01KzJkyKfpBqNvkQr+iYDrd4zA25KzT5 y6AYrN+8bkh1VmkUJRiU/N3UyuVF8fvELxusZeAOqihNYUHX23CsmJyfmooEGvEYP9pW lDJCJXnJeciFMvenPDXmeGhvePViR38MkDRzNgg+K5ykO5bEtGms/YwI5D/hll2ka3ic N/mA== 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=ZaW1gOO8B5HoRhk9OOrw3FvYZPi2QJVJI3rLCHpI7nw=; b=LMGtdyA2UnhCcGgWJFeJyrV1gFeyIUfKmiwW+n0sKVDJ2C8RPlcNiPvKb8KK3+SYef jwW/AlI3hNSEBHWoFxVzHawNMqui1+Nyn8ZZnGkY4d8dWuC2BuJp1qJMmFuln8P/ns6a JL2MMvdKWGuGFUrMogrVgxsB15gBey/9/fKW1WFOBjoLOdmQhhGQIrHPhK9iV1qtQl8/ PSZs7OLQVaevpL5RkVXxLcMFanI1YzVC9npCpmI+QZWlEMJXU78S+nq75mEuMlRBzEeD vL9WhwbfWxDurgvVGabaYWr7wGEFtC+J1Cp8miCp9HZeaK1WoQ4LWB2bg3GdvGDCiJxg l42w== 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 k20si11780694ejq.621.2020.07.21.02.17.38; Tue, 21 Jul 2020 02:18:01 -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 S1728517AbgGUJR3 (ORCPT + 99 others); Tue, 21 Jul 2020 05:17:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:49202 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgGUJR3 (ORCPT ); Tue, 21 Jul 2020 05:17:29 -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 08E86AE63; Tue, 21 Jul 2020 09:17:34 +0000 (UTC) Subject: Re: [PATCH] mm/page_alloc: fix memalloc_nocma_{save/restore} APIs To: js1304@gmail.com, Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, 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: <1595302129-23895-1-git-send-email-iamjoonsoo.kim@lge.com> From: Vlastimil Babka Message-ID: <03e6b134-a2ad-0df2-73bc-9b7542a1bddb@suse.cz> Date: Tue, 21 Jul 2020 11:17:26 +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: <1595302129-23895-1-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/21/20 5:28 AM, js1304@gmail.com wrote: > From: Joonsoo Kim > > Currently, memalloc_nocma_{save/restore} API that prevents CMA area > in page allocation is implemented by using current_gfp_context(). However, > there are two problems of this implementation. > > First, this doesn't work for allocation fastpath. In the fastpath, > original gfp_mask is used since current_gfp_context() is introduced in > order to control reclaim and it is on slowpath. So, CMA area can be > allocated through the allocation fastpath even if > memalloc_nocma_{save/restore} APIs are used. Currently, there is just > one user for these APIs and it has a fallback method to prevent actual > problem. > Second, clearing __GFP_MOVABLE in current_gfp_context() has a side effect > to exclude the memory on the ZONE_MOVABLE for allocation target. > > To fix these problems, this patch changes the implementation to exclude > CMA area in page allocation. Main point of this change is using the > alloc_flags. alloc_flags is mainly used to control allocation so it fits > for excluding CMA area in allocation. Moreover, the ALLOC_CMA flag already exists for exactly this purpose. > Fixes: d7fefcc8de91 (mm/cma: add PF flag to force non cma alloc) > Cc: > Signed-off-by: Joonsoo Kim Reviewed-by: Vlastimil Babka Thanks!