From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D48EC3A5A0 for ; Mon, 20 Apr 2020 08:00:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2C26A21D79 for ; Mon, 20 Apr 2020 08:00:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EeQZY3U0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C26A21D79 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 D617F8E000C; Mon, 20 Apr 2020 04:00:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D12428E0003; Mon, 20 Apr 2020 04:00:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C01158E000C; Mon, 20 Apr 2020 04:00:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A8DF78E0003 for ; Mon, 20 Apr 2020 04:00:58 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 674F4181AEF39 for ; Mon, 20 Apr 2020 08:00:58 +0000 (UTC) X-FDA: 76727487396.11.wax20_5fc38d720a43e X-HE-Tag: wax20_5fc38d720a43e X-Filterd-Recvd-Size: 5206 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Apr 2020 08:00:57 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id u9so4560285pfm.10 for ; Mon, 20 Apr 2020 01:00:57 -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=DSi8Zl5E6C8oRk/MAFIcBEqbn7/mn9+/YHmxcRg+idk=; b=EeQZY3U0r7N00A0ghNyd570WI+TMBfPMdHycrThvyRNwh3vChP+6pqA3n24qK3lh3w t73jEmbdP2+91Z0OxU2PicyVGliRIpZD/m3LR8xBXhwZ7iSvkWZ2jZtcuaJ8ydErrdJS CmEtbz/QIUQyw9hrWt1CA3HsykMrOaiEemg4GiN39cEeSkoUyk/V7YtJGBmtuRFU8X/8 HOLo3OsRN3sYiEUVt/bP3C5MjKd6HaRHVoXiTezDc/Bcgv7YK7kyvyZr+wcT1TW5kFeF EAYXLagqjtp5JMr+3hXW35Id2Pv9/q8Yt0HVIOt4aJJdw/vYNX5nivacF/cXhQf0oI84 EPJg== 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=DSi8Zl5E6C8oRk/MAFIcBEqbn7/mn9+/YHmxcRg+idk=; b=HsIaqYU8z3fJ8L8G81NWyDXbAWTvwymO0A266sZMknUq4PvARHYamgasr+H8/KRJcq HaR9RKvYHLynnqE2ul1hAbNmIySeWB8iIJ8/Da3rtzoPW7i8nFDWvn7KutyUY4+GjGp/ PncO+r+34HeD1rGO9LFg9Eh7OVlgtaJWopipaLLlhcyFdcaJ4IiP6Z5FhbWvXSQRrOKw h7V4R8GF0HvrybNZTOvQ8D7117kA9YJ8eFdCNURYi8fJ7J9GiqGmvKs2O6E2mrgXaNDQ GsTMqZBuuoN1OVqSiCYL8BviFB2mjgdEl68ntcU23Ut5zX2viFb3otCYAOWYYiYLqLMJ e3xg== X-Gm-Message-State: AGi0PuZRUx8DRUMV/UFKAIpbx188g6+X5G4/qfmJw/7oK42q7jd+lvMS QNv2udVxO/Z72ZTZJgniu5Q= X-Google-Smtp-Source: APiQypK7x7myCxQF8VKSUMw/wmdQndZa+A20INmkZwCxUQsaroAlqyLxW9nRCC2v0z5QL7W3rDFKXw== X-Received: by 2002:a62:d086:: with SMTP id p128mr16441164pfg.241.1587369657192; Mon, 20 Apr 2020 01:00:57 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id n9sm314947pjt.29.2020.04.20.01.00.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2020 01:00:56 -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 07/10] mm/hugetlb: separate PageHighMem() and PageHighMemZone() use case Date: Mon, 20 Apr 2020 16:59:39 +0900 Message-Id: <1587369582-3882-8-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 #3 for this patch. 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 1c50d23..fc3a701 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); -- 2.7.4