Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp438180ybz; Wed, 22 Apr 2020 00:59:11 -0700 (PDT) X-Google-Smtp-Source: APiQypIY95Vy+ICiR5ZtXyD1c39GkqqWqRGTVVrh7UYOLGKpEBqve9yZ64rtrWhaq2O0Psj9DYoJ X-Received: by 2002:a50:8e01:: with SMTP id 1mr21685269edw.26.1587542351187; Wed, 22 Apr 2020 00:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587542351; cv=none; d=google.com; s=arc-20160816; b=pWDLbIWN4OjhxWkg07mOXooUKh4WFKMJ7m5hgi0bQHy1I64BGS9T4urar4+WN/dYZ/ 8wZNqD9oSqgQwYNYZEV3XTNWaE1JJAbXJHrpK8vl0ifj64i+jQK3CuKEjTn+3FunYc2/ sygkzlKdSvOSiDaCOyaW0IbHizwSv3b0Ybj2tI3Mg7J61uL7Dp4X4+PTBdBWFS1JX6ab isqz9N6DF/tCithX/mMOJs45JRD41MvdutPNrENUGph7i+lBZnyGOAf8Dibd0WHSMjO5 KRvifhYGNgZZ+64WgJ+uox/Dy7pbyekQzBTNssbmjA0BtuiREFF7sFbndkGRom2sbZeK 5mzA== 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=xHJTiCZuYPHQ76leKfZ3xJ/74uh6M+nUkAErV8qQlvs=; b=kNHIN3P+D02XTbBR+DYfji1C2gc+gMkEYnOVcZAU5NpWcaAAYnqRK6YmKfhpTkAStC aImcJoG7QbMjQIcdfdGi1Zmi9NqR5wIi3+XKAvx+oT6aOudrs+L4vCyBXZ2leEfE7NNM kELAfImRGCKfu2Tq5AHFaXcho+wD/KIqr0l3jnDKpFIYOd3VlxCVKU2Ks3haP6n7AVlF rXNrTFqtr0zxWqbZbYHPV834aueBgvn+D04oys3dXyWQOaMcpGy7YkIPUzVqyAiI9LXV Lk0dL4Q5JCimZdvfCueSsFJhNdS2qlcAGSh/DrTm3/mPHahqG+UsSfyy6ZbM9ogIYDv0 eaiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hkSfCfrb; 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 ss24si2912049ejb.392.2020.04.22.00.58.47; Wed, 22 Apr 2020 00:59:11 -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=hkSfCfrb; 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 S1726413AbgDVHzd (ORCPT + 99 others); Wed, 22 Apr 2020 03:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725810AbgDVHzc (ORCPT ); Wed, 22 Apr 2020 03:55:32 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 147B8C03C1A6 for ; Wed, 22 Apr 2020 00:55:31 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id v10so424035qvr.2 for ; Wed, 22 Apr 2020 00:55:31 -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=tqkA+wyv9Jr5H9Qep8riMltBRFgXlQ6ImEETWkMdr0+CeRJuzI4IuqBz5A8FwQ4/fw FLL706DPYiF4D2ZgiQAZdLMFmMcAo6ck2BPhfYrkuSMk+/0J37iRwh5F3Wrtnd7bnGMo 0L5qDfEBMcVLlTQDPx9UHKrkoswMLftAocexdJwZMXI4iPMisfgg5j6rKM34680oxudj GPrpFPvL9euFHmUGyfIPYfwdHJu2jRL7GcBLFMxSxTBwyvn02RtipDZ5v1dVVnTncB7Y 5xKQzGdVwOx1pyKUoo8aquQSstJDMtXOtPA9N4gEN6DfP0cKh524pljNV8mHwWJeNN+8 d9Xw== X-Gm-Message-State: AGi0PubS684ruoaPyhuGbkyp4z7LFDjcGpUtQ4AvQe50E3JfGF6FzZLm yUYB4riZAPiBQjPysKKuu+umb50QZpCAWkcVJtA= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.