Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3365672ybz; Mon, 20 Apr 2020 01:03:08 -0700 (PDT) X-Google-Smtp-Source: APiQypI0L/J360J+UP8xzUbRYhyp8cucqPSwN76jy5f/jcT8EDf/mZri7PCvG9NQfxHGuZ4emwW4 X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr14409404ejr.49.1587369787846; Mon, 20 Apr 2020 01:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587369787; cv=none; d=google.com; s=arc-20160816; b=ZUsbD7jgdAeooxc3a6ajY9Lmh6bUgGHcy24KkmUi596CxhaHajyh1+BiRjebqxS+wB WoFybggpSpNdmEO+IcNvJ5VJe9pqaKt6DUqXlYH8byAn35lTUrtLR+a+7v6EcSNeu648 doWH3mkHPsk+IEMInNVf66EkTjCDAUdYEO82ChQqNNNe5m307pDNMGDHeUqXRUimxqzf M3QkE8e7vmJcolpFkrd46m2kreDJqPfOj/0uN5pzY4Ao8qQh7phQ55OXR8eHPZsfyBsD 6BA7/iZItsTi81jOgOyD19/v6/JIj1KfjzvJ6o5oQTEOkfINVz7m7aSckYcVay728aoi Pq5w== 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=alIHvAxi8J0gI0njDpPhNJX2AYMkhsIun+mstYhBeyw=; b=GhRZ9J70JCtP/H3MIv46HWuh8ME1xmKJZjKSaJEebzq/XLzDY0cOSlfdEd+uRYWZzi x3CJe/Y92UwCkfyjXgxSf41p6OM/G2b2vQQ6v5EYIjzh13QA9uHkwnJeAzTVOfgWY7TE Ccqg1AJGDEfJ3//AviB9e5lvcIMzat80zGng1pRZHbQ5oCMpwQngr1h56k/FjOYlCS0h ny9/qsVSdfWExRdGaVPoIc56Aya5TaoBcjtkTkKwpzwwNk750eBxmvfBndc+BGyekSHs /6Vh64/w4Q6Xn9gFrN2j1b91a9AQZoadOE+Yhu8cRc39OpxUykr7ZLYLvwqUGBElI06q nWOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dluh6E6W; 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 cw6si97074edb.552.2020.04.20.01.02.45; Mon, 20 Apr 2020 01:03:07 -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=Dluh6E6W; 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 S1726439AbgDTIBC (ORCPT + 99 others); Mon, 20 Apr 2020 04:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgDTIBC (ORCPT ); Mon, 20 Apr 2020 04:01:02 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E57DAC061A0C for ; Mon, 20 Apr 2020 01:01:01 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id t40so4082543pjb.3 for ; Mon, 20 Apr 2020 01:01:01 -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=alIHvAxi8J0gI0njDpPhNJX2AYMkhsIun+mstYhBeyw=; b=Dluh6E6WcvI4lCJpWZru0HsbFamltg/pDLxUXPDdcyd7U73u2Tjuy76v2EqKxIPN1D 8HfOy0yDAfSEDDCFo8/d107vtsHmZaPhqvlyuQC6EY7L6XeoHELvFxBJ+av+24J71Huc GAFwaB5ev5fbbKZzTocmnb1TzfiI2wBFoh6YUP/5jZgdyE9z6PTenV2AJH3xF+wZOBvw 5+ToqCayK/FEfBPb92ENTgpdeHppCkVkswO803xRpv1Re7dpzo0T90E8rDMsjFk0qdzs 5SUonL8Eo+6uRoQ26ijPU006Jhx7mPwwucsRAyrOe4E8tRVDb8AuMFIVbT9R8yLx9fqx GI6Q== 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=alIHvAxi8J0gI0njDpPhNJX2AYMkhsIun+mstYhBeyw=; b=VQImDFxFiLWF+a3yu2Gfq5rbG4+yQI0o3Eydunbr7xYGupvpwroNVffpoRMC2EhbK4 cgWF+5iqLjTieM2zRgH08n6ttf/TPvKjPZQrcMXsvDBFbNOi9PIZmHU2jZFFOYzmQvtP aENGYfyUkd+TPLR0uFeGovmOmi2ox0ErVqJOTolMrFvzlrfGhJDnmWVMH+24G5vUE//R beLZrxA016B0HGbDGpkv8RTqlH4AizH2xIXV0NCk9wyDfuoNF6sD+n5Qc7o5gLenukm0 Vp2iPVWH2uUFUGgl3gNLdsRZTR8YOZiA44ANUk/51yHlyL5tYsSbGbZcRIXmR0pC69rS wFkw== X-Gm-Message-State: AGi0PuZ5GeBttRBE/nBWw32mdPa0uk3WbGrNBK1SeM4EthHJaplp50VG hT4MVDbXZAXky8z9y3lEgWk= X-Received: by 2002:a17:902:968a:: with SMTP id n10mr15110926plp.74.1587369661464; Mon, 20 Apr 2020 01:01:01 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id n9sm314947pjt.29.2020.04.20.01.00.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2020 01:01:01 -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 08/10] mm: separate PageHighMem() and PageHighMemZone() use case Date: Mon, 20 Apr 2020 16:59:40 +0900 Message-Id: <1587369582-3882-9-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 #3 for this patch. Signed-off-by: Joonsoo Kim --- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 8573d2fc..85361e2 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -593,7 +593,7 @@ void generic_online_page(struct page *page, unsigned int order) __free_pages_core(page, order); totalram_pages_add(1UL << order); #ifdef CONFIG_HIGHMEM - if (PageHighMem(page)) + if (PageHighMemZone(page)) totalhigh_pages_add(1UL << order); #endif } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d469384..9997f87 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7470,7 +7470,7 @@ void adjust_managed_page_count(struct page *page, long count) atomic_long_add(count, &page_zone(page)->managed_pages); totalram_pages_add(count); #ifdef CONFIG_HIGHMEM - if (PageHighMem(page)) + if (PageHighMemZone(page)) totalhigh_pages_add(count); #endif } -- 2.7.4