Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp616706ybz; Fri, 1 May 2020 05:33:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKO9jcZEpnwerlf9pECz1prKO3+JGawg+xU3HwAKxIsMSjUHmD4w4vItfEa1VHL7LbMuSiK X-Received: by 2002:a17:906:315a:: with SMTP id e26mr2911946eje.53.1588336394095; Fri, 01 May 2020 05:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588336394; cv=none; d=google.com; s=arc-20160816; b=0Cb0BJ6rhXi18lqGrE8HCz5A2429lXkl0eXZkMk16lc0YhaDxpSPZ0a+W0Ub5x1U4H 0goUzcpzeDmgn35tl8wZXYsWrwYzLbMSKfxlPQkQQtv9sQZYwQGGG/HX0NOFDI9Y8J7z 2jCnF6gPTRSaz9xW6pAsaXZ4QzwI+XDwba4Ss2oakzjeOLgxZX+lqK01bwauzaBxpqcm I9AlGqIfGbLp5qEQSvdhN3pi5Zd1r+7PEuTwm+0nFuHxEphdztMFYlvjrsyHQIH6SayU 4AU+8Ix6vEAN2t8XrX7UT95YG22I3gd9OS+IqSq9HvIxsJHA9TmNIWB4ROLDEj9CH8dk tFZQ== 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=Bdc8uifcR0c4hvJPP9O5By2zoNylxi5bzmzOSpanTI4=; b=UipzG8xmtQ1or1kBJQSl5Rouoe0sPXbBiqL4/X2B5RIss6UpSvf3wT2EPxhZW9xi47 yylL47tDwhEGyU8otOFvOASCx6hongnrJvdWctltIkn+ky3pQPjY8KSyKhjP3Cq3ubu5 tUSOh8yedWOjRYBOPAGLJDYdfq426pDryECqUNOY9XtAHzkbuH5waHNmecqBUSz5QIWN 5rcNcR5FOZyBIUt456VWxIZYjlpav6qCsiKlIIpSDQygCsZgRYSWWSObtwMGAMQvF0RL 7gkundMRvFPkUKtZAWXHCBmC8mlm9MIHzIWlsr7hziZ4PZh0gnKe7Xvsm1rzLFbgWKoC QOug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YwGS5t8J; 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 nm2si1730452ejb.243.2020.05.01.05.32.49; Fri, 01 May 2020 05:33:14 -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=YwGS5t8J; 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 S1728715AbgEAMa4 (ORCPT + 99 others); Fri, 1 May 2020 08:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726131AbgEAMa4 (ORCPT ); Fri, 1 May 2020 08:30:56 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0137BC061A0C for ; Fri, 1 May 2020 05:30:55 -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=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 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: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.