Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1176010pxb; Fri, 26 Feb 2021 04:37:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMmJgZGaccslYHl7Da2CC+tefjP18BGwDEVhiVWI3d2yQBGyb2Y8KGCVc1yESdzVZSbUSH X-Received: by 2002:aa7:d1cd:: with SMTP id g13mr3037529edp.369.1614343027486; Fri, 26 Feb 2021 04:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614343027; cv=none; d=google.com; s=arc-20160816; b=MrpVrEUxMzD9cF1NmXH0/K4+quwO0jz3AoNgp59u0wf+Kz53Ii15zycwV331MPKRtM odwPpzaezAu1otynnVPwEcM2b8auvab9vjCqVh3zj3tDlKDsIdwElTE6raKTYlkaizAK aNElEnsUadVup5sPQAZYeys7MFMdIANSNJ/B6+bK/6USCHgH7p4NFifNwpUpRqYRLykZ XIGtKJQSthjYWs8EtMo1CCbdjQdYAkwA1Hxhhr9SYHIFyZY6ITI4EgU1TbXRzcnI5eXv bCv6AWlm/8H4E5jZz8oO/z6imRCQqGQlNyp9Hu/u8N7g67MLXTvXm/dH5ChWLVX08UBT ILSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=wjaPsUJVXdPTPkBfCgmmoZh8/wsrqlJtXaB8Hk5vERw=; b=Xt2zMARMV3O/UX+jilx7/iNkmZGCYZYWT0G9NGNO1EAe+8xe91KhcnwgCFIP50NjU7 5XaVFfaRVbT1LJTxfUbCzTX80cmlI4GPjSVG+3mul5Htfn9q/KWdhxhHQh7nLHLe7arN 4jmhzJAvON7lO9zo1RtgdsqCKFNqj9hOA4/foJd8Hk6H0wiDKpnv1btajWaf9qFqYXsC TbgijrT/x/QiheUvP7j8KPSTWbyqqaa5r3YjZC+NEtLvO2BSn8PR2klvD7VYFnFB3z+1 v9ZyS47iOp9OmljJvGM5SrFtXgwKv/n6dA6yBPhV4zP8MyYaH93+bpAn3WFFdcAJUL7Z 7cfw== 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 g24si5798847edh.565.2021.02.26.04.36.44; Fri, 26 Feb 2021 04:37:07 -0800 (PST) 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 S230019AbhBZMfJ (ORCPT + 99 others); Fri, 26 Feb 2021 07:35:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:49074 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbhBZMfI (ORCPT ); Fri, 26 Feb 2021 07:35:08 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, >