From patchwork Mon Apr 20 07:59:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11498335 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2F5381 for ; Mon, 20 Apr 2020 08:00:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A613B21D82 for ; Mon, 20 Apr 2020 08:00:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fdQHIPT1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A613B21D82 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 B3E0B8E000B; Mon, 20 Apr 2020 04:00:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AC7728E0003; Mon, 20 Apr 2020 04:00:54 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B7088E000B; Mon, 20 Apr 2020 04:00:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 821A48E0003 for ; Mon, 20 Apr 2020 04:00:54 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 293155850 for ; Mon, 20 Apr 2020 08:00:54 +0000 (UTC) X-FDA: 76727487228.22.drug23_5f262587b4a03 X-Spam-Summary: 2,0,0,bce4fd97e8ae7f9b,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3872:3874:4321:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11473:11638:11658:11914:12296:12297:12517:12519:12555:12679:12895:13053:13069:13161:13180:13229:13311:13357:13548:14096:14181:14384:14394:14721:14819:21080:21444:21451:21627:21666:30054:30070:30079,0,RBL:209.85.215.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: drug23_5f262587b4a03 X-Filterd-Recvd-Size: 5122 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Apr 2020 08:00:53 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id w11so4652015pga.12 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=I/pR5aTGPulpjo2ChaLp7ygMvH6cJdLNZYnYEDrcBsRJyz+5qp3QrkniK7ph5NoJSZ +C50C9iN+4Ap1julER+MMivOoylz73cOPOXSPYM+VEwZMjViNghISYwcYqlB0/NrbUDr spngzspRE3BHeZ191PXckt1Mn/PT22uS8bxxkNzYlrDrK6Z6dzifJ1CQuslfPsU1Yw+7 b4rlzGy8vY+WkXVYCEYJGoIObOi085K7VxDD4K2AxCNeZcFwLQTRv7C0MD5rRohuKQXT o9GwvEZfDkKAI7GlWLwNEr+OXluQLdXf2BDASOcxOj0ahpucyeGedl8KpvkiBfWRN7bK qECw== X-Gm-Message-State: AGi0PuYXTUIYzRpzSvLxSmpX+A5EShkO0jrwOhMFAij9B9qAPbFMAgNZ 3FbMk4Dv8LS6AYcFE6PjojY= X-Google-Smtp-Source: APiQypL2ITbegcNjaGG8rgkKtk56hMOUjxCaEefh+DxxiWwKZ06Ga0Tj4IvO9iBqVVTIypqxVp6/8w== 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> 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: 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