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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 D16ACC28CBC for ; Mon, 4 May 2020 03:08:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D5C020643 for ; Mon, 4 May 2020 03:08:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LXdnC+un" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D5C020643 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 205D38E0005; Sun, 3 May 2020 23:08:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B6308E0001; Sun, 3 May 2020 23:08:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CC6F8E0005; Sun, 3 May 2020 23:08:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id E91AD8E0001 for ; Sun, 3 May 2020 23:08:35 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AAF911787C for ; Mon, 4 May 2020 03:08:35 +0000 (UTC) X-FDA: 76777553790.01.mint55_6818e42f05f1e X-HE-Tag: mint55_6818e42f05f1e X-Filterd-Recvd-Size: 6609 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 03:08:35 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id b6so1824437qkh.11 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=J0D2lIyDJTTgiuMMdLB7w2WU/YTCzmWuU+BeZGnr93FdYcMdZzMQbgaST+EcdBOpQb V5B8VsVXK+1hckDFNVivJof9v4Jc3TQ4u+SNZ1DWQrDd8rmkbqhf7HKSIw4cIWECgeln mW/oAtBu824H91RGVGskjDQAaKd21fqFZkDoh7GJJHJzkKjSRfsSvG7otVviffiJKPrK BXvL1uYEVMqLWGWcL0bXnrubDNc4FYS1/1FeZuVnbM38i7aVG5FXvEyMUc6I00u0PuI1 1ZzTSCItJYqktnfA5uQQl0nYPje3B4Up8Der5a08LgATv6WNUw+ZpwQ5p0Vo2JMi18VX AyiA== X-Gm-Message-State: AGi0PuZBn+jf0nFL7ygr/6Mf7+W9hqYF2Z257ur1+DX8EbE4PKW81Xhe G8HssE/jDTEXYTN+syzIMe4tUHp62sldWRt+n64= X-Google-Smtp-Source: APiQypJSQ7AnUC4tEEmS5jB9JBL/9zuVylZoB75Jo58DUXvy+7Rt6Qhw4kwyh7crVQlvuRZe0VE3DvgZ2WuMM11vy4Q= 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 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: 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.