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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 79E04C433FE for ; Thu, 3 Dec 2020 15:07:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B945E207B1 for ; Thu, 3 Dec 2020 15:07:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B945E207B1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 05DD98D0001; Thu, 3 Dec 2020 10:07:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 00E4E6B0068; Thu, 3 Dec 2020 10:06:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E19D18D0001; Thu, 3 Dec 2020 10:06:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id C44186B005C for ; Thu, 3 Dec 2020 10:06:59 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 87142247F for ; Thu, 3 Dec 2020 15:06:59 +0000 (UTC) X-FDA: 77552298558.10.turn91_420c624273bc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 6EA4516A0D2 for ; Thu, 3 Dec 2020 15:06:59 +0000 (UTC) X-HE-Tag: turn91_420c624273bc X-Filterd-Recvd-Size: 5769 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Dec 2020 15:06:58 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id u19so2439875edx.2 for ; Thu, 03 Dec 2020 07:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a1iPrMkb0iX1XvtR+qTACxaYKXWZSPoP+tl7W9BGvHQ=; b=ixOggIJMdAbM8y8k0hlBNIOBcAoFI4ZlpBsXYeyrhVL583C/wTkfuB56SPFcUtImBF KXPMdYYfsT8cT16Ec8DTWsj2kLWzRo8zxeE9hgzZEwMUv1rFZWG3D2Dn9Iy943jBm7Jb bKt2zpWQSjijAefPwl9y7qUjrbConnEb1o+0OMp3VVWrJEKrQaQy9yY1+Xv8+WMz355x tXGQECjj6RhKuRXQPLSwVRc570dD7Z5QTZEYFhpBRkSVRrxq5k1CDQlLx6VJB6L8StgT jYWz+o4LimGeIWt77Wr2ksR9gT4U+LIgetKKlNtwfi8pWmK8hmU9n+SjjaJ6mCTyg/IY C6og== 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; bh=a1iPrMkb0iX1XvtR+qTACxaYKXWZSPoP+tl7W9BGvHQ=; b=kks+O/l6AwtgZggFSDJbs5STR4MHRyaIfUA048cY4+F9UjjFmutnoiMb0Nj+mgCH7R jORa3V0mIWAEsCaYqvMLihEmOZaOnszhEmTD+GO7PzBNfCkVEJ0HBzveWg//GOVClYJf JCgBSC1q1AzqpRF8KN9JV4umUwk7rEo/QWYjgavd4GmQlaJQcye1OQAfUv8/RHhhfewa A+4Y87/PB2tvULKimHSDcm+suQHq4ZVu/bt3bG9jh0//GI1KY2gyQ5yZjOMTFKdqgI33 o/BYi+1JSp2kXUdT1E9fqAI2KvFj7Xcb459KIEfDU3EMtLr4X9GgKyZR22Zlsle/CJJh hQ4g== X-Gm-Message-State: AOAM532pvXVMGle01zZTSmABmtM4g7ZhHPGES3BQZdv8FOynZGGpyrQU kuZJ0VLkit+DEm3SMKPbjUkNEy56IbnpjgwrFhXQSw== X-Google-Smtp-Source: ABdhPJxGaMgQhso6rpkxxrb8k6AG9G2HGQLYHfqIOpYAY40150Oe/yvCghUxlQrMFOvrhCpQ5GEg8WLA/QZXRkfLg04= X-Received: by 2002:a05:6402:456:: with SMTP id p22mr3221593edw.26.1607008017570; Thu, 03 Dec 2020 07:06:57 -0800 (PST) MIME-Version: 1.0 References: <20201202052330.474592-1-pasha.tatashin@soleen.com> <20201202052330.474592-6-pasha.tatashin@soleen.com> <18c9ab89-185b-395a-97ce-31940388df0e@nvidia.com> In-Reply-To: <18c9ab89-185b-395a-97ce-31940388df0e@nvidia.com> From: Pavel Tatashin Date: Thu, 3 Dec 2020 10:06:21 -0500 Message-ID: Subject: Re: [PATCH 5/6] mm: honor PF_MEMALLOC_NOMOVABLE for all allocations To: John Hubbard Cc: LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Jason Gunthorpe , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes Content-Type: text/plain; charset="UTF-8" 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 Thu, Dec 3, 2020 at 3:17 AM John Hubbard wrote: > > On 12/1/20 9:23 PM, Pavel Tatashin wrote: > > PF_MEMALLOC_NOMOVABLE is only honored for CMA allocations, extend > > this flag to work for any allocations by removing __GFP_MOVABLE from > > gfp_mask when this flag is passed in the current context, thus > > prohibiting allocations from ZONE_MOVABLE. > > > > Signed-off-by: Pavel Tatashin > > --- > > mm/hugetlb.c | 2 +- > > mm/page_alloc.c | 26 ++++++++++++++++---------- > > 2 files changed, 17 insertions(+), 11 deletions(-) > > > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index 02213c74ed6b..00e786201d8b 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -1036,7 +1036,7 @@ static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) > > bool nomovable = !!(current->flags & PF_MEMALLOC_NOMOVABLE); > > > > list_for_each_entry(page, &h->hugepage_freelists[nid], lru) { > > - if (nomovable && is_migrate_cma_page(page)) > > + if (nomovable && is_migrate_movable(get_pageblock_migratetype(page))) > > > I wonder if we should add a helper, like is_migrate_cma_page(), that avoids having > to call get_pageblock_migratetype() at all of the callsites? Good idea, I will add it. > > > > continue; > > > > if (PageHWPoison(page)) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 611799c72da5..7a6d86d0bc5f 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -3766,20 +3766,25 @@ alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask) > > return alloc_flags; > > } > > > > -static inline unsigned int current_alloc_flags(gfp_t gfp_mask, > > - unsigned int alloc_flags) > > +static inline unsigned int cma_alloc_flags(gfp_t gfp_mask, > > + unsigned int alloc_flags) > > Actually, maybe the original name should be left intact. This handles current alloc > flags, which right now happen to only cover CMA flags, so the original name seems > accurate, right? The reason I re-named it is because we do not access current context anymore, only use gfp_mask to get cma flag. >> - unsigned int pflags = current->flags; So, keeping "current" in the function name makes its intent misleading. Thank you, Pasha