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.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 467C9C433E0 for ; Fri, 26 Feb 2021 12:34:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F05664F14 for ; Fri, 26 Feb 2021 12:34:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F05664F14 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 D883A6B0005; Fri, 26 Feb 2021 07:34:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D39486B0006; Fri, 26 Feb 2021 07:34:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4E5F6B006C; Fri, 26 Feb 2021 07:34:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id AEC996B0005 for ; Fri, 26 Feb 2021 07:34:33 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6F88918075BF0 for ; Fri, 26 Feb 2021 12:34:33 +0000 (UTC) X-FDA: 77860362426.14.6515232 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf13.hostedemail.com (Postfix) with ESMTP id 5E79DE0011F1 for ; Fri, 26 Feb 2021 12:34:25 +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 61E1CAE72; Fri, 26 Feb 2021 12:34:26 +0000 (UTC) Subject: Re: [PATCH 4/3] mm,shmem,thp: limit shmem THP allocations to requested zones To: Rik van Riel , Hugh Dickins Cc: Andrew Morton , xuyu@linux.alibaba.com, mgorman@suse.de, aarcange@redhat.com, willy@infradead.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-mm@kvack.org, mhocko@suse.com References: <20201124194925.623931-1-riel@surriel.com> <20210224121016.1314ed6d@imladris.surriel.com> From: Vlastimil Babka Message-ID: Date: Fri, 26 Feb 2021 13:34:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210224121016.1314ed6d@imladris.surriel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5E79DE0011F1 X-Stat-Signature: rhuj4r9tdpry6fncgpbjpehib1bbxw4x Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1614342865-894412 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 2/24/21 6:10 PM, Rik van Riel wrote: > On Wed, 24 Feb 2021 08:55:40 -0800 (PST) > Hugh Dickins wrote: >> On Wed, 24 Feb 2021, Rik van Riel wrote: >> > On Wed, 2021-02-24 at 00:41 -0800, Hugh Dickins wrote: >> > > Oh, I'd forgotten all about that gma500 aspect: >> > > well, I can send a fixup later on. >> > >> > I already have code to fix that, which somebody earlier >> > in this discussion convinced me to throw away. Want me >> > to send it as a patch 4/3 ? >> >> If Andrew wants it all, yes, please do add that - thanks Rik. > > Trivial patch to fix the gma500 thing below: > > ---8<--- > > mm,shmem,thp: limit shmem THP allocations to requested zones > > Hugh pointed out that the gma500 driver uses shmem pages, but needs > to limit them to the DMA32 zone. Ensure the allocations resulting from > the gfp_mask returned by limit_gfp_mask use the zone flags that were > originally passed to shmem_getpage_gfp. > > Signed-off-by: Rik van Riel > Suggested-by: Hugh Dickins Acked-by: Vlastimil Babka > --- > mm/shmem.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index ee3cea10c2a4..876fec89686f 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -1539,7 +1539,11 @@ static gfp_t limit_gfp_mask(gfp_t huge_gfp, gfp_t limit_gfp) > { > gfp_t allowflags = __GFP_IO | __GFP_FS | __GFP_RECLAIM; > gfp_t denyflags = __GFP_NOWARN | __GFP_NORETRY; > - gfp_t result = huge_gfp & ~allowflags; > + gfp_t zoneflags = limit_gfp & GFP_ZONEMASK; > + gfp_t result = huge_gfp & ~(allowflags | GFP_ZONEMASK); > + > + /* Allow allocations only from the originally specified zones. */ > + result |= zoneflags; > > /* > * Minimize the result gfp by taking the union with the deny flags, >