Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp430608ybz; Wed, 22 Apr 2020 00:45:55 -0700 (PDT) X-Google-Smtp-Source: APiQypJfFFE4gyP7mOmsY5pM3OaJnaUUdJ8K48yJaP04Hw0sc35EN6JpZWDG+ATJWS4XTgGqiqdm X-Received: by 2002:a17:906:970e:: with SMTP id k14mr25015787ejx.202.1587541555714; Wed, 22 Apr 2020 00:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587541555; cv=none; d=google.com; s=arc-20160816; b=Nw74j+/bV/vQn0mq+o0W9sDfEDkgUcGM6VfMIGl+WAyYTzOk8evOKaCvmMy8TjfCry 6BT5uHUEOgrxLv/7il19B0v3lbyawtAqN0VgJBm2+sgKpySg6B8E5v4qC88BHSvGoIgg LJlEeQAs5W+nt7sZuSfzn/BKtNHxkZFkXIL7o5/GVTJZzGPYScfsw+UtCk6E26Wj2Zda Dr/ry1+oSZrdIStPpREdZk6e+bykRbcZaIawpW1eGlmqJJmS1AgeWMzQ8Eq0VpgSs3q9 4006kr9y28FesCjERiwBM8xBEU3L/jLgjZz6YPdjMpmteke/dJ1l15liyS5QpsC8aYqW CjpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Vb8WfOWxjm/MnaPsL9+qBHJ7m7UkiiF7A/1WuSmoehQ=; b=qSIbBWb7k6Mjo6zZ6AsCzAAqCL/rOXEqwVwPPD0IOgFtJLKt2fIBvJE3QfjYrIuSCT dq81qizzA1QeCZi8rvnUSrPIy0PG2BABIEefJFyI7oOF1lTPlCCrFFUIyZsbknBGVTbG dPqweT4KJVsTPiuK8IBJazIIauE7fY0CphzwwUzgPrUotS38Oiakx3pfJdvzE1vabjUB Rcl7NGFJcjO3P63DCjPsG27kTPilTt27ZOv/tk0kLp7Pn1cgNlbtBUo3HieDRoc2GoCu HYQYM5iIvD91zSHkxb6zPlxMPS59/M6vt37xrctRFADyCN72jHmTFuMy2sQVsbwo7Jub 9P9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nB6Trxxb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si2970291edf.454.2020.04.22.00.45.32; Wed, 22 Apr 2020 00:45:55 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nB6Trxxb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726294AbgDVHob (ORCPT + 99 others); Wed, 22 Apr 2020 03:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726077AbgDVHoa (ORCPT ); Wed, 22 Apr 2020 03:44:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A997CC03C1A6 for ; Wed, 22 Apr 2020 00:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Vb8WfOWxjm/MnaPsL9+qBHJ7m7UkiiF7A/1WuSmoehQ=; b=nB6TrxxbQTqxLF5B0N1QGMH7hG JnJatWxU+DRoPVQufO2OrfkyqKD3UldhS15OhvCZYRbjlDd2+vPnuTpJV9V8v01tSq7W6UprQrVuV HsCJ4HPKoVThhuZOoabk3f/M5N+5kqBULHmez6VPQQuBZ7wQRdOUyAWEHSewmg1Sl6xd+KRjNpQSe F14wd7uuU72dlOyl2hhozvCnSOTn9mlkXKorGX30H0vWa8bTGl4AyIFJFP0vK5fJpxkznyF4YcJKQ +D3LGbgp9zr8QVpCAMIZ7PCB9/zizqOUSYQ0/nfDsXIn5HfU0ByQHQ4mWCvobuhWa9W8rnaFplNvV aors5CRA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRA3T-0003kL-Ho; Wed, 22 Apr 2020 07:44:23 +0000 Date: Wed, 22 Apr 2020 00:44:23 -0700 From: Christoph Hellwig To: js1304@gmail.com Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, 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 Subject: Re: [PATCH 03/10] mm/migrate: separate PageHighMem() and PageHighMemZone() use case Message-ID: <20200422074423.GA12288@infradead.org> References: <1587369582-3882-1-git-send-email-iamjoonsoo.kim@lge.com> <1587369582-3882-4-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1587369582-3882-4-git-send-email-iamjoonsoo.kim@lge.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 check > if there is a direct mapping for this page or not. The other is to check > the zone of this page, that is, weather it is the highmem type zone or not. > > Now, we have separate functions, PageHighMem() and PageHighMemZone() for > 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 implementation > 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 page *page, > order = HPAGE_PMD_ORDER; > } > > - if (PageHighMem(page) || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) > + if (PageHighMemZone(page) || zone_idx(page_zone(page)) == ZONE_MOVABLE) > gfp_mask |= __GFP_HIGHMEM; I think this would be much cleaner if you open coded PageHighMemZone here. E.g. int zone = page_zone(page); if (is_highmem_idx(zone) || zone_idx(zone) == ZONE_MOVABLE)