Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3206453ybz; Sun, 3 May 2020 20:32:05 -0700 (PDT) X-Google-Smtp-Source: APiQypIGe2Yc482Tg2mBLxXRzkAS4gIhRly2reXs+kumeOjE/uEz72esxXsJUtvTsZG617LdpCbC X-Received: by 2002:aa7:daca:: with SMTP id x10mr12444139eds.59.1588563125440; Sun, 03 May 2020 20:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588563125; cv=none; d=google.com; s=arc-20160816; b=eKzcUJm/kFwgnQ9DrWpS9t04Qp7nt9BKarom/KCJMgzeEQ/GCtfl69ZJV8KZc6U6FC UdzT71znTIveot2GvwRs4KpXUXk2DRExd5feGgZkqwfV2CcWLUi9BpAi54bXMhXar8Wz 8p/aVikOHFGcnLw3WCM6D8yJkhxJop0aDYfs8s+Vaclx2oA68e626BZ/qydJ3cdh7eoI hRi2U5jz0+ASo1wo/OP1Bvbo7A0EDKOkzjOZjbJu7X9jYYiAPMWiHnHsxqH1ZO/vidMy 71xguRr2Avh9V9kGzPjxFjf97M5WvBrcLPVg2egC4+nFaAZLB1t/fVQvZ1u/tJP0hpLC DdFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=qxxlvs+YEH140nApT4Xf3QR0858RxvcLN+In9z+Kg3k=; b=hvfajGe8ZuA0Wi4y4nMt0KprgmkCMyI4ROQlvcen3+t42Tnkl2rCAm2/chgJFnvcby A7zEBHKwQJKM2syq94b/Pn/ex7ZAqJ+VxYzlNbcUBdd51+NEx02WxaBDs4+u/vnpynvU jznLJC272yqMuk9DjAlDd2k4oledsPZ/rWswDksd57provzgyydwjVEPMlm+oO+yXe29 VdVnbFBitD5hGYoVqtVEKdYXRwHp8U4KndXJxQ4I4FMG2pOqzcQJjQDJ3oWgbsEdtG9I 9tYSvqsFjI+plkWOe4B9EC6OQSNDxCBvgg9KmkpuGzRK4gjmXqqfIuw1udvm5I4cdNJa LD7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LXdnC+un; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si6136262edr.14.2020.05.03.20.31.41; Sun, 03 May 2020 20:32:05 -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=pass header.i=@gmail.com header.s=20161025 header.b=LXdnC+un; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbgEDDIg (ORCPT + 99 others); Sun, 3 May 2020 23:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726768AbgEDDIf (ORCPT ); Sun, 3 May 2020 23:08:35 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9631CC061A0E for ; Sun, 3 May 2020 20:08:35 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id f83so7933811qke.13 for ; Sun, 03 May 2020 20:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=qxxlvs+YEH140nApT4Xf3QR0858RxvcLN+In9z+Kg3k=; b=LXdnC+ung25aN57duHnahyoDG/bRnYKkQSnGQpKbTRGn1KqaPvFKi6fC83m4x0x5fA GxoZ1YzN6BwXJMuKXAG43o8pvI4ruFzQv9X2iNU1EUEl0ufglImj17wCAFbLr7vtqfMA bVJJQRIhVrDkBdOLu98tF4j2N0jcFZd8kWofv4uEyyFzK+1Vk0cy0TOM8pJlgKvgFM2C K8ZpcmaZ7FFw9c7jBgVD0sjVzQZd/JxEHFhNUFx3FSGX8GeY8h2RJCmYnxYRQf9dGMXV 4lGkkVcu9gONbXZmJSZESnseETS8BFRodQsekPeewjTJ+2Mi10Rfn761I6N+q2WAHCcL AN5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=qxxlvs+YEH140nApT4Xf3QR0858RxvcLN+In9z+Kg3k=; b=gKurGMsQmVSaLZ/fYeQIJ8bc+fHdzZR0lksWMVk2IU6sTk2/sYGBvCacymVN6ASuB7 rPSmtqVime1e66DJ8D56Eq9DkxOT/xTWXDEjqVc77ULQ1+oBwJ8bILAB17Z+AefJieP2 Ycld15pZ/3skXosWOSJYszU8YMOFv7hMUe5cXfYIb+7/fU9qwZY+n8oSwVyrDTHTceg1 PPpqVU0Ft8Tx70lyZb2LQfHGHjzAyRelqebgRwg4cT9idh6KYJ9hCmCNDH+dClfSTnE5 KTlgaTph+T3yUSisdDTCZV0dGf0IKNEj4lnmjsnUpQZTNwCRI9IdyxQkZZjs5XJcnxO1 rD2g== X-Gm-Message-State: AGi0PuY29YyK7gbGReBv7WsE6hQ124BfCheanLtTr6Y0LYr1a/Ifgri/ izXUXBEg1zZh5c4QV7hiMc1OZLBcyn9wMoft7/o= X-Received: by 2002:a05:620a:138e:: with SMTP id k14mr14477321qki.452.1588561714646; Sun, 03 May 2020 20:08:34 -0700 (PDT) MIME-Version: 1.0 References: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> <1588130803-20527-8-git-send-email-iamjoonsoo.kim@lge.com> <20200501123052.GD21897@infradead.org> In-Reply-To: <20200501123052.GD21897@infradead.org> From: Joonsoo Kim Date: Mon, 4 May 2020 12:08:23 +0900 Message-ID: Subject: Re: [PATCH v2 07/10] mm: separate PageHighMem() and PageHighMemZone() use case To: Christoph Hellwig Cc: Andrew Morton , Linux Memory Management List , LKML , 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, Joonsoo Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2020=EB=85=84 5=EC=9B=94 1=EC=9D=BC (=EA=B8=88) =EC=98=A4=ED=9B=84 9:30, Ch= ristoph Hellwig =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > 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 che= ck > > if there is a direct mapping for this page or not. The other is to chec= k > > the zone of this page, that is, weather it is the highmem type zone or = not. > > > > Now, we have separate functions, PageHighMem() and PageHighMemZone() fo= r > > 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 implementatio= n > > 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, unsigne= d 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. If I can kill all the PageHighMemZone() macro, I will use page_zone() above= . However, if it's not possible, I will leave it as it is. It would be simpler than your suggestion. Thanks.