From patchwork Wed Apr 29 03:26:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515955 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 DA04592A for ; Wed, 29 Apr 2020 03:27:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A73792068E for ; Wed, 29 Apr 2020 03:27:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YHm1orTY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A73792068E 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 DE5768E000B; Tue, 28 Apr 2020 23:27:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D96008E0001; Tue, 28 Apr 2020 23:27:31 -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 CABB18E000B; Tue, 28 Apr 2020 23:27:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id B039D8E0001 for ; Tue, 28 Apr 2020 23:27:31 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 725DC181AEF07 for ; Wed, 29 Apr 2020 03:27:31 +0000 (UTC) X-FDA: 76759457502.09.cake07_7bdabb6b0a733 X-Spam-Summary: 2,0,0,4dd972683cae9dca,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2559:2562:2898:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3872:3874:4321:4385:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11638:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13053:13069:13161:13180:13229:13255:13311:13357:13548:14096:14181:14384:14394:14721:14819:21080:21444:21451:21627:21666:21990:30054:30064:30070:30079,0,RBL:209.85.216.66:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.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:25,LUA_SUMMARY:none X-HE-Tag: cake07_7bdabb6b0a733 X-Filterd-Recvd-Size: 5312 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:30 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id 7so1843853pjo.0 for ; Tue, 28 Apr 2020 20:27:30 -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=xBEYuUoQ8e6Da7eJez+k7YxQ5sLYFa5M+7QyRrMMcew=; b=YHm1orTYXSGPPZ6rqzsy/Z/aCobIKLDOgp51Ebnl4u0atgV1seGtUvn3mvdSefeL0Z vrTYiCYMoXXmkOAiEyE6Ry3VQW9HjOiFO54tdgL6mm/rhzb/67x4Kl2dym1y448PxHVf sIETeXeYrRQBYv3OAE+ieKZCXJrSm6TzbJWwOhrxaAmJzPor4gWC4kqExLtmgAbxrqxk n9G4MjSlV/+pnc8q39kVqp5qs6wAMCro8PwBaP8WKYjjvElE8LsGatoLohA/hXjEjnQJ arahQkyJ1rTe4qhEcx2D1A837Qa/Zx+jZlOg4hDscCjyMeHzeoup+J7fUdIzZSXU0oIn Ne7A== 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=xBEYuUoQ8e6Da7eJez+k7YxQ5sLYFa5M+7QyRrMMcew=; b=M6m19asuyAoA/VwWRoVO5WDrEF1+fiwWdnlPsUCZBEGbARX0DNs7GJVTDzkurauno/ vpmq15m7bNkH866l1MRkbksuOgfbZwyXOTcHGiFG7FGEZ3Qzt6/Xnd2GK/G81EO9UyJx Fwer50Sw7uIVISem3d8FlGaa2P3jwelJGmyyp5rBJ5hb8wXJQcxuu9HG/u6GJCJ/VTxQ l2Gkb8CBQGcu+xpGobIZ0Zqi3wrfjCVP8PIis/zY5roqZUTmCsFlANivJjEFCjyOYfNp LRlNPag3rvHVuqkdlAxAvW5FPXyYt33xm06RUt7U8yxZJqrqMxC/kH+XVoNuppTLoqkS VqFA== X-Gm-Message-State: AGi0PuZf9gKaylXUYC42FcPSKYtRIRPuKI+wwmQrnaGPrWYIqFdRtqAh 3/aVlVqp01yq+fQ975PL4zo= X-Google-Smtp-Source: APiQypIMe4cvTWcJXIHZJ0unZHCNL7cX9pPrPhdcmwMdDewi2uTows2IMF6+5o/DmWzKsJrROyXIkw== X-Received: by 2002:a17:90b:93:: with SMTP id bb19mr736039pjb.134.1588130850170; Tue, 28 Apr 2020 20:27:30 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:29 -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 , kernel-team@lge.com, Christoph Hellwig , Joonsoo Kim Subject: [PATCH v2 06/10] mm/hugetlb: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:39 +0900 Message-Id: <1588130803-20527-7-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1588130803-20527-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 #3 for this patch. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5548e88..56c9143 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2639,7 +2639,7 @@ static void try_to_free_low(struct hstate *h, unsigned long count, list_for_each_entry_safe(page, next, freel, lru) { if (count >= h->nr_huge_pages) return; - if (PageHighMem(page)) + if (PageHighMemZone(page)) continue; list_del(&page->lru); update_and_free_page(h, page);