Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp610974ybz; Fri, 1 May 2020 05:26:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIoiZicPa9sjckycJW4EghFMZCYpSk9QarG3bXI0gaCdG/gtKte5078jIoKno7Uh6ZXPqrv X-Received: by 2002:a50:9f0a:: with SMTP id b10mr3284772edf.159.1588336011683; Fri, 01 May 2020 05:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588336011; cv=none; d=google.com; s=arc-20160816; b=KrIOCBEsHzUVG6ps1438H74bKaMtFRhv+WesxelW0t7lyGqyYiFwx/rADq637uNmHZ VhlCOSMEOD+JMKOVqmxMvWH36s55S/uSX0Z6kOV0lBc/mYwFAFKhx4jsRj81TjCufRfS Y7YMN7FQgYLgtI0+tvQzh1ct0nMoLL/h7o9hWVQ8CiRdiMw0ATznV9l2jgDTXQehecD6 Xg/grZDsl6+IQObWaOj68FfXrkDMyvh2SLH8XgiF/JcN+ECsNF/860ugeEmlGJYWQPbO G/UqjbEJ0d+1wUaArGe7D4h+B66qASOykLhTJ2no3E5EqEVVB+WohPwwmj84H7IWWe5F 2dOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=d8B/MysH0iSyYJt4VMjpzq137TPEbHeCixl/G5VtNO0=; b=iooGYQxoopg94ceVgpA2QHRTCfIanYPD4Dj9DnpOJfEh34DcbpvzPTCueebj6XRmp2 iju8x1PHu8j/ezqSdG5b1UQAl1jNvNQRAf4DedeZzyn9vMnnPkbA4l30gdf1kIsKqT9j PotXK9f4Seaufhv9ENsoRatJBhW++bl4thNIhwIkn7SxFaxm4RQPXB0ncJ74j8ELgplA 39vz4mB0cFy69Ae/80FNwijY99s0eMG1E8g09s+CMJ4/v4wOwzmogSQL61s3TdEmFGWF Za6BMF/RFUT6z1oSpxh2QcTYOxYW/je7S5xBWWGf71i8Hrf/zBP4En7KKKnzaIRSTUCo s0VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EbrurM0p; 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 a88si1609567edf.379.2020.05.01.05.26.28; Fri, 01 May 2020 05:26:51 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EbrurM0p; 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 S1728755AbgEAMY3 (ORCPT + 99 others); Fri, 1 May 2020 08:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726131AbgEAMY3 (ORCPT ); Fri, 1 May 2020 08:24:29 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD18FC061A0C for ; Fri, 1 May 2020 05:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=d8B/MysH0iSyYJt4VMjpzq137TPEbHeCixl/G5VtNO0=; b=EbrurM0pZcDW79I3d230iHROz9 UkQB7jjd+34VLhwrqzQzsYIXOkWHknFbSzg4pAtBlCYaEKHZZRruG0WgYK5KcDB1f6rtF3O0e4K/d ekRb6CyN3w1OiCOjlOs65VbScyvfKjQ9zRjHK5hZL4lRuP+ihXqRh/bAU9Pv4s6xUXVc8xQpldAwS 4Tpv8/Um7Sn5Up2qS39kAiEtbh5LiJMYy/adIvSNv+Ds5azkXz7rOj2RuF62kYavl1Pkp7MQPSukk CcGgkFcjo9ztRz8qLZcn1faB1fvxG7WW+FQPHazJeH5eMqnFWXsdRdQHPmWx3zIt89isbRH9t9JQU Y9W0GR0A==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUUiR-0000wL-Oz; Fri, 01 May 2020 12:24:27 +0000 Date: Fri, 1 May 2020 05:24:27 -0700 From: Christoph Hellwig To: js1304@gmail.com Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Laura Abbott , "Aneesh Kumar K . V" , Mel Gorman , Michal Hocko , Johannes Weiner , Roman Gushchin , Minchan Kim , Rik van Riel , Christian Koenig , Huang Rui , Eric Biederman , "Rafael J . Wysocki" , Pavel Machek , kernel-team@lge.com, Christoph Hellwig , Joonsoo Kim Subject: Re: [PATCH v2 05/10] mm/gup: separate PageHighMem() and PageHighMemZone() use case Message-ID: <20200501122427.GB21897@infradead.org> References: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> <1588130803-20527-6-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1588130803-20527-6-git-send-email-iamjoonsoo.kim@lge.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 12:26:38PM +0900, js1304@gmail.com wrote: > From: Joonsoo Kim > > Until now, PageHighMem() is used for two different cases. One is to check > if there is a direct mapping for this page or not. The other is to check > the zone of this page, that is, weather it is the highmem type zone or not. > > Now, we have separate functions, PageHighMem() and PageHighMemZone() for > each cases. Use appropriate one. > > Note that there are some rules to determine the proper macro. > > 1. If PageHighMem() is called for checking if the direct mapping exists > or not, use PageHighMem(). > 2. If PageHighMem() is used to predict the previous gfp_flags for > this page, use PageHighMemZone(). The zone of the page is related to > the gfp_flags. > 3. If purpose of calling PageHighMem() is to count highmem page and > to interact with the system by using this count, use PageHighMemZone(). > This counter is usually used to calculate the available memory for an > kernel allocation and pages on the highmem zone cannot be available > for an kernel allocation. > 4. Otherwise, use PageHighMemZone(). It's safe since it's implementation > is just copy of the previous PageHighMem() implementation and won't > be changed. > > I apply the rule #2 for this patch. > > Acked-by: Roman Gushchin > Signed-off-by: Joonsoo Kim > --- > mm/gup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 11fda53..9652eed 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -1608,7 +1608,7 @@ static struct page *new_non_cma_page(struct page *page, unsigned long private) > */ > gfp_t gfp_mask = GFP_USER | __GFP_NOWARN; > > - if (PageHighMem(page)) > + if (PageHighMemZone(page)) > gfp_mask |= __GFP_HIGHMEM; I think this wants to stay PageHighMem. This migrates CMA pages to other places before doing a long term pin. Anything that didn't have a direct mapping before won't need one for the new page, which could also include non-highmem zones without a highmem mapping.