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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 4FB07C4724C for ; Fri, 1 May 2020 12:30:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C9EA208D6 for ; Fri, 1 May 2020 12:30:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="YwGS5t8J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C9EA208D6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 899BD8E0005; Fri, 1 May 2020 08:30:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 849908E0001; Fri, 1 May 2020 08:30:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 739088E0005; Fri, 1 May 2020 08:30:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 5DEDA8E0001 for ; Fri, 1 May 2020 08:30:56 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1BAE28249980 for ; Fri, 1 May 2020 12:30:56 +0000 (UTC) X-FDA: 76768084512.21.curve97_253d58d2b5d3c X-HE-Tag: curve97_253d58d2b5d3c X-Filterd-Recvd-Size: 5061 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 12:30:55 +0000 (UTC) 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=Bdc8uifcR0c4hvJPP9O5By2zoNylxi5bzmzOSpanTI4=; b=YwGS5t8JdPB3Z3qA64W7pxhZ2z KUMDXSQhqrWD77KlR5FTR+NKpB+Sy9UQzH7a+2U8sWMelF3Vad2N+z05pUPlurXarTPvrBigGWb2v Adpq+7KF5ZIdkm5RO18yh6pRdIwOnCyeUr5fn2iMTbR4nQ70idjirtRW7CiJYBcciVOJR+bmQGPSn QmLcXHCTxXPyOIIiMkRUUHt/FiQ/pILWZ3w+lnLODfvfaEi5+GKJLbunbH2FjbIHCSf9/BS5nPOUo 3qTDIhRCxjz1pQqyXq01z9cbYm/6I4ZMGwyselbAzVANZCiby04sKTWs5SR87sM7yBcbE4tKvaW5r /bhztg+Q==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUUoe-0006lN-JD; Fri, 01 May 2020 12:30:52 +0000 Date: Fri, 1 May 2020 05:30:52 -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 07/10] mm: separate PageHighMem() and PageHighMemZone() use case Message-ID: <20200501123052.GD21897@infradead.org> References: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> <1588130803-20527-8-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-8-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 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 Wed, Apr 29, 2020 at 12:26:40PM +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 #3 for this patch. > > Acked-by: Roman Gushchin > Signed-off-by: Joonsoo Kim > --- > mm/memory_hotplug.c | 2 +- > mm/page_alloc.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 555137b..891c214 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -593,7 +593,7 @@ void generic_online_page(struct page *page, unsigned int order) > __free_pages_core(page, order); > totalram_pages_add(1UL << order); > #ifdef CONFIG_HIGHMEM > - if (PageHighMem(page)) > + if (PageHighMemZone(page)) > totalhigh_pages_add(1UL << order); > #endif > } > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index fc5919e..7fe5115 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7444,7 +7444,7 @@ void adjust_managed_page_count(struct page *page, long count) > atomic_long_add(count, &page_zone(page)->managed_pages); > totalram_pages_add(count); > #ifdef CONFIG_HIGHMEM > - if (PageHighMem(page)) > + if (PageHighMemZone(page)) > totalhigh_pages_add(count); > #endif This function already uses the page_zone structure above, I think life would be easier of you compare against that, as that makes the code more obvious.