Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3366909ybz; Mon, 20 Apr 2020 01:04:45 -0700 (PDT) X-Google-Smtp-Source: APiQypL6LG6Xvge3BcGUEGvhvSh2tGQEx5oiYKJ/2Zm5/0PcIl2dXbA3PWc6md3NGzggW5HLbgSa X-Received: by 2002:a05:6402:888:: with SMTP id e8mr7441518edy.132.1587369885838; Mon, 20 Apr 2020 01:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587369885; cv=none; d=google.com; s=arc-20160816; b=YoD3+eP7ChIUTqMnulOm42BScHmIZ240t++0MoY5ytH+R22EmJmNbESt32wLIAWPpL LNb3N0ZzpX5YX7SOOPdfOccU00dWJnrYW95TMShze3xM65HMiQEgt8Wu52GVNJrL7XOC rvf52K7GTqcXIZ+9UwBqCzdv8Iiew37CnKHsKu9xDRi6cjodPYY9NXoqJfBQ/KMFqWbd 9rf5lXF1kGP6RY9hMKg+ByI2piHFXDMOtkGny1w6/VbnzImU3bLOAUTcxBU6RuV/jG0b pTMATlf/SxP56ZdnnzEA/X68YG9k8bAqLJxzto4G0KxgYz/LVmC7Ewv5dDgEIWo62Skw CwOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=G/wuob1wBc0uGcbRuTvY4jgnkdXzxj6DiOgk3GS0MzM=; b=JrnLx/yN033KNKJqSvEhPs1dRRT4MsM4ybMg21iz/mTNbkJZZ0kSKUvp7OUWlG3ojN P9O8unNj0xLi7YlFYgVm/z0NEs1VIAaS6w7dSrZ6EJ8Higq5WEAfDBh6RtuPdb9Nq4xX 90deMsWahbbqoRSTv3fmlfTHjI6O6BuyTtaowbEni0bwqam0Em9TKa6vr+Rycjyhh6Rw kNflGLo42spEBFDOBSkprjbaZY2EeHfniYpprRgsTnXpnkxsDfksbOUeR8Rb+o88z52m RgQo+ROWTb3SAw41Z2WCsvfrLwlM3POIy0I+SxVommhESwzVpeEqVSHImXGz4gKaEQBV Y6eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fdQHIPT1; 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 w16si112029edq.89.2020.04.20.01.04.23; Mon, 20 Apr 2020 01:04:45 -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=fdQHIPT1; 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 S1726410AbgDTIAy (ORCPT + 99 others); Mon, 20 Apr 2020 04:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgDTIAx (ORCPT ); Mon, 20 Apr 2020 04:00:53 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61924C061A0C for ; Mon, 20 Apr 2020 01:00:53 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id n16so4665700pgb.7 for ; Mon, 20 Apr 2020 01:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G/wuob1wBc0uGcbRuTvY4jgnkdXzxj6DiOgk3GS0MzM=; b=fdQHIPT1rwwJ5DrceIYUArOc+74FSdCBMoF3QA857fnNN34SFou0axcbsXC9m03XQZ abwjovn06OxQYSSaihJZ9uzsaE/67YhzBjC5Y0yb2/1A2OCvg1TF+SoKsBhI2RXMncY7 +Mu7WwHTJ2PY+fOSirsrjxy+7CT1mqUDbYqMdH4hD7MJWhMeV8Ym2VJzSVS9CdobOCgC 9I54GhNU2nlmnJLLexdsUQbQQutshuT1qdCzvaPdB5BtITXq/2ehr/ruTcM5e26MQqdx 5fl+1qLJ3qhKoWffSDiBC65fWi1jw0Ti/flwzqjabQlHMnTqLifX1lOJivGQk0q1raqT qoyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G/wuob1wBc0uGcbRuTvY4jgnkdXzxj6DiOgk3GS0MzM=; b=SW/p7ZGEjRBTM2qn+BXsISG/ntZX2dywTOIbB9Fwb6uLbHlAUdMcbz0E/a+1KCF41l nEamzfg5IEqWzqD/9q24HPmIqQAMgrdogw7oj5XFtAq9ZAWa7ckb7zulp3a3jGM7cAOW fGiO5t+OX+4YorSQHZoF4kdHxeeyNpWtEFrrx3leytfPYux7XlaLhGCPCdOC1FIPn/oP q97maQoUswyiqFNZfmm6GU1InjK/YN9Bl8T+juARJbRTDI4aPeSCV83OoBHM03cKlNLN tVgTxwwbk1mzH0ClZbYDfTCNzFVuTVt8tqOuKr2bJyh8ZoCp5HaaXVyvAhmvt1I7CP65 5RrQ== X-Gm-Message-State: AGi0PuYxBm9W0MPULa05FADlHx+gCBZtJJSAkbqM7R+uB5DyyyDaiff4 sb5WgfcMxkuBprWo45gF8FY= X-Received: by 2002:a63:7c1:: with SMTP id 184mr14869032pgh.77.1587369652882; Mon, 20 Apr 2020 01:00:52 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id n9sm314947pjt.29.2020.04.20.01.00.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2020 01:00:52 -0700 (PDT) From: js1304@gmail.com X-Google-Original-From: iamjoonsoo.kim@lge.com To: Andrew Morton Cc: 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: [PATCH 06/10] mm/gup: separate PageHighMem() and PageHighMemZone() use case Date: Mon, 20 Apr 2020 16:59:38 +0900 Message-Id: <1587369582-3882-7-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587369582-3882-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1587369582-3882-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 43b0d83..5199de0 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1603,7 +1603,7 @@ static struct page *new_non_cma_page(struct page *page, unsigned long private) */ gfp_t gfp_mask = GFP_USER | __GFP_NOWARN; - if (PageHighMem(page)) + if (PageHighMemZone(page)) gfp_mask |= __GFP_HIGHMEM; #ifdef CONFIG_HUGETLB_PAGE -- 2.7.4