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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no 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 7E5E7C28CBC for ; Mon, 4 May 2020 03:04:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 371ED206E6 for ; Mon, 4 May 2020 03:04:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Aj6+XjLr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 371ED206E6 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 DC9348E0007; Sun, 3 May 2020 23:04:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D79118E0001; Sun, 3 May 2020 23:04:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8E0C8E0007; Sun, 3 May 2020 23:04:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id A678A8E0001 for ; Sun, 3 May 2020 23:04:01 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6A83E180AD80F for ; Mon, 4 May 2020 03:04:01 +0000 (UTC) X-FDA: 76777542282.06.ant90_402fd7613ee47 X-HE-Tag: ant90_402fd7613ee47 X-Filterd-Recvd-Size: 5535 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 03:04:00 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id g185so1754857qke.7 for ; Sun, 03 May 2020 20:04:00 -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=e7sgBnBT1wP45v5viJmIT67GFvpsSurDqbZz1YoZUIs=; b=Aj6+XjLroMtzqqWVTf9yQI4wRHT0VL8XMEar76BYr8AclX+XtT5Qti+y3oZZW015HW mH23e+8LC7CCk2oAKlQBJp6uiv5l2YfKYNG7j9FHx8bIwL8cmItI6+8h8EckjHhOEuEX CVgmY7MhMqySp6NjlloRpjxLP9UcABulb2kGCeMTUdarbR4r+Air43q+uSdA+2nLAd7y pyiWx9VSPs78/MDpJ5TEGpl7FzdBoaaTzkRcSedICzWY/NgVw+Cu8reoZPMr/ifJQLr3 oS/3gbuCJ156IErS/n9Ja3NiZQTGftkibKu1POfgcHp9BwaqH3t464NJw26N0VVdwXZT gjzg== 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=e7sgBnBT1wP45v5viJmIT67GFvpsSurDqbZz1YoZUIs=; b=hIfYsbKyZW1EODuk8RrTkSs6LywCpGmupBeyNHL5RkTbV4YujaOCkHADBuH8nskBjp u4M1yrAnCbYFwc1Lss0kNHufEc0iDI37L1qG8WlOKv3xYTcv7W/NZdebfTYJ0/MEXMhL SbIOaFayvqJY4iemGaIQal96lqoHfXAmi2vT218ZG6R7T8bLF7xbEgXWvvUJWlPnZVSl celfklBQjoSUjkabpe0DSKaiYbR3WQdnb/NjOC2pMUv2BddgjTTfbkcvnV5uHMhYsn54 pRtkjQJQttVGIZcW227LRsptO40RJT0AEtLyoBh6tDC9zh8Gwd17SlMwnt60xCDGG6Lm 1NKQ== X-Gm-Message-State: AGi0PubRqR37b5jPjfHPLbBtGqErNY2Ba+vVg+jjvoBOvzn+xFUSiFhd vkx4P340HBvlJ7qWdkIVBjoT7HTB+Bmc2wNjfi0= X-Google-Smtp-Source: APiQypJ9pcf6NPr9u5AZtq+fbHXE8dQimRLrtcQROrIaSTUQgfrCZ9kdwR6D3907lKqIydwzwWustn8oufsSAvnj/ig= X-Received: by 2002:a05:620a:15c1:: with SMTP id o1mr13733706qkm.187.1588561440426; Sun, 03 May 2020 20:04:00 -0700 (PDT) MIME-Version: 1.0 References: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> <1588130803-20527-7-git-send-email-iamjoonsoo.kim@lge.com> <20200501122655.GC21897@infradead.org> In-Reply-To: <20200501122655.GC21897@infradead.org> From: Joonsoo Kim Date: Mon, 4 May 2020 12:03:49 +0900 Message-ID: Subject: Re: [PATCH v2 06/10] mm/hugetlb: 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:26, Ch= ristoph Hellwig =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On Wed, Apr 29, 2020 at 12:26:39PM +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 > > Why do we care about the zone here? This only cares about having > kernel direct mapped pages as far as I can tell. My understaning is that what we want to do here is to first free memory that can be used for kernel allocation. If direct mapped page is on the zon= e that cannot be used for kernel allocation, there is no meaning to free this page first. So, we need to take a care of the zone here. Thanks.