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=-8.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 89107C433E6 for ; Tue, 21 Jul 2020 09:17:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3924C20792 for ; Tue, 21 Jul 2020 09:17:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3924C20792 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 CE17D6B0008; Tue, 21 Jul 2020 05:17:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C8D796B000D; Tue, 21 Jul 2020 05:17:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B60546B0007; Tue, 21 Jul 2020 05:17:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id A10496B0007 for ; Tue, 21 Jul 2020 05:17:29 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 52676D0D09CA for ; Tue, 21 Jul 2020 09:17:29 +0000 (UTC) X-FDA: 77061529818.22.rifle39_4607c0826f2c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 253B51800CA5F for ; Tue, 21 Jul 2020 09:17:29 +0000 (UTC) X-HE-Tag: rifle39_4607c0826f2c X-Filterd-Recvd-Size: 2822 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Jul 2020 09:17:28 +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 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 X-Rspamd-Queue-Id: 253B51800CA5F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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/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!