Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3196233ybz; Sun, 3 May 2020 20:12:00 -0700 (PDT) X-Google-Smtp-Source: APiQypKWMqPhTGa5vAQA5teKC1KCsXNEIz7HczLwPGFNm3hc52LXcKTQMZER0EpAUnqURf1MI8SJ X-Received: by 2002:a17:906:30c3:: with SMTP id b3mr13368466ejb.126.1588561920287; Sun, 03 May 2020 20:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588561920; cv=none; d=google.com; s=arc-20160816; b=l1c1iQQ6M3EdXiedS7h7+ntGsQLHUI03aJCQXUh8Bl8nmcAQ/CR9sqjqWqUCn2uwAh qb1YjClYLbYb2qx0o4hA/dL/LAKFCVTomg1+LnrDn4ov+OZLi+gGIM/GzhoGHK/SA+r/ GOUjy/CQeJE3+sTzse8u9hst7dxHjyNOkC7EbAJUcwKU62vQakVzw1i7DI++9/TmzjN+ 5TCQ+pB8Nqj0tsWhj2CsI5J7Ht/8OQUV/ctIuuo9iaTbIVefQ7q1Q9MmdNs/3VPcBzuk SwUyo7vFFv/nBIiVDH2wgVsr+UNqXELe1vvPKKEaOtfYP8pmMdQbtBZx2RwinGWafap+ tzkg== 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=e7sgBnBT1wP45v5viJmIT67GFvpsSurDqbZz1YoZUIs=; b=SXiCPMTeUg75gAIX/KcmVLcfmfewlu/a5Q2fbXlAWBp2vKQkxfHZxXhHTqnc5Q9Sx+ twdU63nQFYfWwHdWwZQffEEdIgixOgDELpjYS3If5I4XM5VpQ0d2SvtAWAhCx9nR77YA nnJfhFfutUFCLoeFQUm6tunEB0TICJDci9GWMnts+2M2v0/e5+PCIYun1EZGtCpEuEEp KZfMBefx53xj7yeZv7ZXbmgmfIM48UJPbYYpJMIgBEKjs8T4ufMTC/LAWwGJwXDx0sox 1QAcOu9ELZ5HT6tAd8QZGaPjErFx56KQl881od1JD8bz+A4MhNjEtJ/+e1mZghSdenUA 3AWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Aj6+XjLr; 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 c17si5996602ejn.336.2020.05.03.20.11.35; Sun, 03 May 2020 20:12:00 -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=Aj6+XjLr; 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 S1727111AbgEDDEB (ORCPT + 99 others); Sun, 3 May 2020 23:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726927AbgEDDEB (ORCPT ); Sun, 3 May 2020 23:04:01 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F7FC061A0E for ; Sun, 3 May 2020 20:04:01 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id i14so4057213qka.10 for ; Sun, 03 May 2020 20:04:01 -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=bUCMKSiG5zEkCOOtBGPl50FWcvnoiIjG6xz/8DVIkec8g8PRYOtww8pyTA8PRVCO4H /Ab1hWoTrJ2IL5RDTasEq7jGdlT8VD8MqQ6ss/TJmLqeoOeEbdznTwpfJI7qL0tGwmQv hvKVtOb1QCkqDeVgg5RjydHA1Q5z6y50Zv3/gCVDSiBH58Y/GcymzNfbe3kn+8iU7Q0W S417VIeThWhElwfCxmASJHOmifeowIsGhg/EC1NCO2Lz4qG62SV21Srj+/6nWWnPODKk JQjkgAnZQ1XaggN30mybxFMJDIas+gcjs8LtkvaN6mgkQ0mR084kWwanLGMyb9NIqkNR oNQQ== X-Gm-Message-State: AGi0PuZWDL6bnOWErTm8emm6vb/NWcM9NIQdjfHWhXFxjtzC+SFlDaA3 Uicf4mux5CmfTfvUtBIhuFzb6aHK99oeS5kJa0o= 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 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: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.