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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 08330C433E7 for ; Fri, 17 Jul 2020 09:02:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE240207F5 for ; Fri, 17 Jul 2020 09:02:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KmAcPyW2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE240207F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4DA608D0026; Fri, 17 Jul 2020 05:02:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B06A8D0009; Fri, 17 Jul 2020 05:02:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C68D8D0026; Fri, 17 Jul 2020 05:02:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 2616B8D0009 for ; Fri, 17 Jul 2020 05:02:30 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D20C92BC09 for ; Fri, 17 Jul 2020 09:02:29 +0000 (UTC) X-FDA: 77046976818.19.pet88_370631326f09 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id A7D80160AD for ; Fri, 17 Jul 2020 09:02:29 +0000 (UTC) X-HE-Tag: pet88_370631326f09 X-Filterd-Recvd-Size: 5765 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jul 2020 09:02:29 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id b4so8092323qkn.11 for ; Fri, 17 Jul 2020 02:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=p1NZQG4oEUmz0+3wGuzHtIVKKrGOlXRqs3faFoSCavU=; b=KmAcPyW22oZTklkSOJdP9sECeg8GNajPulowq4jdUx80ZzgXmYSx7Pgit5PSlF5KGo 68leyRdN5oEI9gwYP4wAD6wUqSZ1wbIVYc4gkHIQT2vQwT2MYmO1QwDheD+Gs6r7h/cy fOezCazJFpNCAZwNI1TlcG5Aj09BZVDBVkwBwkwc7TTjvsplIVjgA9/PDR15fFIbI29I N+LKElnxxLOdnFcZajoj7zDDKx0jvtxJ/e51bGTR9WygigcFYg/9Z+OApin3nFME1skS /Mc16DeMkYBD0CgLts6+1b7MsvqCcKv5pLhU3WTo0Ki85bs5zr89DkvUrLg1jMKa/Cd4 ovUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=p1NZQG4oEUmz0+3wGuzHtIVKKrGOlXRqs3faFoSCavU=; b=XkjhBxY1fonpYkYk82sViyAZBBCNT7a7ibYHkpjBJaaOojiCkS5Erj6YD0zMIL7d73 HTrc9RdPwpqfZ82X+Vu+pjOlq+31kSzSLwwWxYxQeGaz+q+iKv0SyrH7Azmu66rpgfww fs9caK4JI560x2EO9psijbFLR9bahPCSM0sNT4lUVW9/wMAmcERBX26xEq/bsvvlNBeQ bJp11dAcCmNsKJUcGVFq7EUjAHmnnHyt77T1Go8VvO9ptHJaIIomSAsnO/6QI9iFKDdU rYVM8+kkgikz/3dWn+uG00BsT8yzfezq0CqdyIXQqcsEOzTD1KLzoraXXhVmSR4wl4RX b7LQ== X-Gm-Message-State: AOAM532AgJLIWDzFCOmnPdnMwYfctYBX/2F2NTmNlC7BxTBbNJZwKAzl Evf6RFQjvBeRMXgREIfbRvrD9NgldRelgCcZNKrzfg== X-Google-Smtp-Source: ABdhPJzKwZp67n8bEinZ+vfbtHSzjOCHp6TG9fY7EVHJC3NPWwu94kDQSMYoR4vJEAxftZUAsKRRbPxLNr7pKNwW6Bs= X-Received: by 2002:a05:620a:a1b:: with SMTP id i27mr7768542qka.429.1594972009242; Fri, 17 Jul 2020 00:46:49 -0700 (PDT) MIME-Version: 1.0 References: <1594789529-6206-1-git-send-email-iamjoonsoo.kim@lge.com> <1594789529-6206-2-git-send-email-iamjoonsoo.kim@lge.com> <20200715082401.GC5451@dhcp22.suse.cz> In-Reply-To: <20200715082401.GC5451@dhcp22.suse.cz> From: Joonsoo Kim Date: Fri, 17 Jul 2020 16:46:38 +0900 Message-ID: Subject: Re: [PATCH 2/4] mm/gup: restrict CMA region by using allocation scope API To: Michal Hocko Cc: Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , "Aneesh Kumar K . V" , Joonsoo Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: A7D80160AD X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: 2020=EB=85=84 7=EC=9B=94 15=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84 5:24, M= ichal Hocko =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On Wed 15-07-20 14:05:27, Joonsoo Kim wrote: > > From: Joonsoo Kim > > > > We have well defined scope API to exclude CMA region. > > Use it rather than manipulating gfp_mask manually. With this change, > > we can now use __GFP_MOVABLE for gfp_mask and the ZONE_MOVABLE is also > > searched by page allocator. For hugetlb, gfp_mask is redefined since > > it has a regular allocation mask filter for migration target. > > > > Note that this can be considered as a fix for the commit 9a4e9f3b2d73 > > ("mm: update get_user_pages_longterm to migrate pages allocated from > > CMA region"). However, "Fixes" tag isn't added here since it is just > > suboptimal but it doesn't cause any problem. > > But it is breaking the contract that the longterm pins never end up in a > cma managed memory. So I think Fixes tag is really due. I am not sure > about stable backport. If the patch was the trivial move of Previous implementation is correct since longterm pins never end up in a CM= A managed memory with that implementation. It's just a different and suboptim= al implementation to exclude the CMA area. This is why I don't add the "Fixes" tag on the patch. > memalloc_nocma_restore then it would be probably worth it because it is > trivial to review and backport. I suspect that longterm pins in CMA > regions would cause hard to debug issues where CMA memory will not be > available. But I am not really sure this is a real problem considering > how many long term pin users we have and I have also no idea whether > those are usually used along with CMA users. > > Anyway I think it would really be much better to isolate the > memalloc_nocma_restore and have it first in the series. The reword of Unfortunately, it's not possible to place it first in the series since memalloc_nocma_XXX API has a bug that could return the CMA area even if scope is set up. It is fixed on the first patch in this series. > the __GFP_MOVABLE functionality is orthogonal. My logic is that, we basically assume that using __GFP_MOVABLE is possible in migration target allocation. And, it was necessarily cleared in order to exclude the CMA area. Now, we use the other method to exclude the CMA area so __GFP_MOVABLE is added like usual. If you think that it deserves to be a separate patch, I will do it on the next version. > Btw __GFP_NOWARN change is not documented. Will document it. Thanks.