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,URIBL_BLOCKED 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 7343EC5518A for ; Wed, 22 Apr 2020 07:55:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 303A6206E9 for ; Wed, 22 Apr 2020 07:55:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hkSfCfrb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 303A6206E9 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 D0C628E0005; Wed, 22 Apr 2020 03:55:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CBBA88E0003; Wed, 22 Apr 2020 03:55:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAA708E0005; Wed, 22 Apr 2020 03:55:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 9FE3F8E0003 for ; Wed, 22 Apr 2020 03:55:31 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5D866181AEF15 for ; Wed, 22 Apr 2020 07:55:31 +0000 (UTC) X-FDA: 76734731262.12.steel84_1310a9c758b0e X-HE-Tag: steel84_1310a9c758b0e X-Filterd-Recvd-Size: 5997 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Apr 2020 07:55:30 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id v18so405558qvx.9 for ; Wed, 22 Apr 2020 00:55:30 -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=xHJTiCZuYPHQ76leKfZ3xJ/74uh6M+nUkAErV8qQlvs=; b=hkSfCfrbbAm+HLe+KrV3RnSh5abeV84ZxoVl1yBMh4PJWTsG6DPJ71QVKL9JnIizob UlWuIriCsDXjOcyzBeWrjzDKgK1TD87LvDqAUih8jmOnGdkOK6wX+D1ZJOvVdXcAbmWv 1rr2qAB99SaM72ln8DVQI7B1G//UcBaebKO5JWsWryhmU7WXIm4GDPs5rnh5oNKDRdTH c0vLrwcafB3oUhhyBPCF3d4YnqADvl7fxEFw97+EwoN5zRrDxHy3l6oR5m8snGjkqc22 O9EDoKCESqQPsJjlKuroJngWV2rzL6YZg1+QHtbhSqF3Ov/SKRKU6vAMQ9QIDYmqceFm XcrQ== 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=xHJTiCZuYPHQ76leKfZ3xJ/74uh6M+nUkAErV8qQlvs=; b=Q7N5dwnEMtomqPIm4SrP0eqpMCKjd6wOS8mP/rsnU889Ifu1fYhiQaMvNwz+Oq3NhE QSW1EI3VcAEukFEMNEPrsW1mc5q7cG8HURlLAWyW7fNzWlDTRASZRUgmcLrikTbDicHq vR9bswvb1iKFatmutEGoPPyu52Z39kkeT4aAgzw8SeKC8gsX0GKWNbA3WIe0DhlkP59j hFDSjEdIP6MsuCknaRM1mIP8Jk/0xhn3mlC2MsWVbCDVeynqNzLV+0UFtvQGlcO/s2KA 01hYWo0AfC/Pci7EEVXs6jLtPtm1gaYvOCwvjIgS3TeHn7sa3lfVtvxvY2EKwsh4/Ire ljuQ== X-Gm-Message-State: AGi0PuayO3Qy1QMFaFgG+XzqwWnqL5I/3XqrBs6id6TkekhRPI84+RNY hFUQeo/1GZggw1J0nZIUOwT37Sn12cw7XfZYgII= X-Google-Smtp-Source: APiQypKE3uqNyzRviE2W0tPIBqg/0GXqy4kx8ZZl/teh095sCD9n/vA1kn9Jl8aI22VF+9NjuQOhGgAHTgJEjrjyIB8= X-Received: by 2002:a05:6214:7e1:: with SMTP id bp1mr23425411qvb.208.1587542130191; Wed, 22 Apr 2020 00:55:30 -0700 (PDT) MIME-Version: 1.0 References: <1587369582-3882-1-git-send-email-iamjoonsoo.kim@lge.com> <1587369582-3882-4-git-send-email-iamjoonsoo.kim@lge.com> <20200422074423.GA12288@infradead.org> In-Reply-To: <20200422074423.GA12288@infradead.org> From: Joonsoo Kim Date: Wed, 22 Apr 2020 16:55:19 +0900 Message-ID: Subject: Re: [PATCH 03/10] mm/migrate: 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 , 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 4=EC=9B=94 22=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84 4:44, C= hristoph Hellwig =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On Mon, Apr 20, 2020 at 04:59:35PM +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 #2 for this patch. > > > > Signed-off-by: Joonsoo Kim > > --- > > include/linux/migrate.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > > index 3e546cb..9a57766 100644 > > --- a/include/linux/migrate.h > > +++ b/include/linux/migrate.h > > @@ -47,7 +47,7 @@ static inline struct page *new_page_nodemask(struct p= age *page, > > order =3D HPAGE_PMD_ORDER; > > } > > > > - if (PageHighMem(page) || (zone_idx(page_zone(page)) =3D=3D ZONE_M= OVABLE)) > > + if (PageHighMemZone(page) || zone_idx(page_zone(page)) =3D=3D ZON= E_MOVABLE) > > gfp_mask |=3D __GFP_HIGHMEM; > > I think this would be much cleaner if you open coded PageHighMemZone > here. > > E.g. > > int zone =3D page_zone(page); > > if (is_highmem_idx(zone) || zone_idx(zone) =3D=3D ZONE_MOVABLE) Okay. I will use open code here to make two condition checks similar form. Thanks.