Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp819959ybe; Wed, 4 Sep 2019 08:13:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMBq+zEjlMtlQ3C2T3SRJpVrLGi7tosrRVT7QBIhB/3dBt5iuS+51n4QLf1V+KMu3aRYzo X-Received: by 2002:a17:902:4581:: with SMTP id n1mr42051086pld.310.1567609991686; Wed, 04 Sep 2019 08:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567609991; cv=none; d=google.com; s=arc-20160816; b=CcuY50GurQT0kMsFCYrT8NH9D7UVchgQgntgiOVbU72W9fT7K5qcU/NZfcNROrG45A Cht3xbdpgdKbPjvMwcXqOAOKonmQKziLvzI++KeGxJVuZYvR89tNNpCHLrR5kJi/evea vkouuJO8xpHBkIW8BWP9jXsCDjpaY7U4eoh6IqReAQcFK0CnN7ajJHlMDLwl4Xxl+R6x aIE/KjAy15mXoN+Ra+fjzyPsvOcev/OS1UetF0IDuB3T0ixwMjM9rX3NsWQNW+19qcU8 c3ieIK2c4KhCu82CZVTTZx0NbGcSCLToFkm4fsRBdmZaFuAVIuoxlwp8PckP6JcKl7RC Bwhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=p6kpa+V/mOCw2Z+/w4fmfqemmfT1IhqWlu84Sk3ejgg=; b=ajdw4tnFJEeq/bgT+JfjxHkvY5fVzUosAJSm1mY5zlcTFG9uSuMAUjnmIvAAKGMPlf LWGWkGOpX9DYFbMTf2ZEUqGC872GynLc78jWwueb73EzAIwWsym3syxmu2aCphTDose2 wm9aE4qtXRxVIoeZFwyc3hT8H8WgCIc7W4se01RCMOGh7jZODTGbEY59aUaLjCbGtnmR cuyzjoYBdXXcQZh7ibXyGUWc46RmmScab/7SlPDKXMgYCEHx+XXU1JLpZ9dKw4LDrMJW ap3+KCgkFc7Lije9QQgFTyzPZNiMa7k61F9NSTR6g6Kd0fJUqh0xQRPjhLvm1wVKe1d8 iSoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UFkLFQpC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 65si21461605pff.220.2019.09.04.08.12.56; Wed, 04 Sep 2019 08:13:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UFkLFQpC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1731338AbfIDPKj (ORCPT + 99 others); Wed, 4 Sep 2019 11:10:39 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38799 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730714AbfIDPKj (ORCPT ); Wed, 4 Sep 2019 11:10:39 -0400 Received: by mail-pf1-f194.google.com with SMTP id h195so6883765pfe.5; Wed, 04 Sep 2019 08:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=p6kpa+V/mOCw2Z+/w4fmfqemmfT1IhqWlu84Sk3ejgg=; b=UFkLFQpC7E14Ptl4qhmREGp8b+BS/boPhGg+O4m+5ArD6kZf3FfjmAiTLZuUmkI9Ty OZGjg3C0zJnk4XgjOsLLfFKed7k3HdgxKtDtveiknbYQRkBFjfuYYrVB+kI8mX3tc0YF 3gyE136VMmMvaCZhCWqAA1f0NuTsdCQL/n9hMLMCmC/yyNcUO7rzgc6bBfuSYVQn7QO4 4xfcHLLp9fjwzH5U/MDqPGMleIl53/lI+O/0ubte1uyIFmU+nYcd8R9VSVkwaet4v8lc xPSSdiyMlPiEooJhGOKIrRD23sse/vHSBlGXXWob+PZTqG0xKym5Z7Xfx+mPx4Sn4C11 j4Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=p6kpa+V/mOCw2Z+/w4fmfqemmfT1IhqWlu84Sk3ejgg=; b=FZyZ2Z7c18l2CTsOb8eYCJumWxLdvH127Gm/Q95njIgV0Ju6bMzwgQy1h7sj7GcQTf xurDrCpoceSV/znMXgX1a42VVYXF/93t2cv3cjZ1FT2Qm3aMKng/W9GkSrg3Nf2Uu7Qe 9fIbBtqYZ8M/O3FRBPRyIR2yHPWvYJ65fQE14rqz/KAH2ZCe0yMUK4aeM9VtCN5MJXKf 4yjJUHZmVz5vUhH5ifLe/ik+LxzXHF3gR2kUFIaCh3ntmerrEhDS7DsSiDLuxSUosh8v +02QHwuaX91MgrGmScn53BXnTD/g8t4AWqR1PfuK79DL6rnyucfWLOkRqRyo+C7y7ww/ 13+Q== X-Gm-Message-State: APjAAAWmYLFk94eIfiyp/NXCHKBtpvjztTpSelRZp6ksLvzf+jdg9PsN Gok99nyCCGX1yfYgIsBN+Rs= X-Received: by 2002:aa7:9343:: with SMTP id 3mr15433820pfn.145.1567609838132; Wed, 04 Sep 2019 08:10:38 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id u69sm25695517pgu.77.2019.09.04.08.10.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Sep 2019 08:10:37 -0700 (PDT) Subject: [PATCH v7 2/6] mm: Move set/get_pcppage_migratetype to mmzone.h From: Alexander Duyck To: nitesh@redhat.com, kvm@vger.kernel.org, mst@redhat.com, david@redhat.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, virtio-dev@lists.oasis-open.org, osalvador@suse.de Cc: yang.zhang.wz@gmail.com, pagupta@redhat.com, riel@surriel.com, konrad.wilk@oracle.com, lcapitulino@redhat.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, alexander.h.duyck@linux.intel.com Date: Wed, 04 Sep 2019 08:10:36 -0700 Message-ID: <20190904151036.13848.36062.stgit@localhost.localdomain> In-Reply-To: <20190904150920.13848.32271.stgit@localhost.localdomain> References: <20190904150920.13848.32271.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Duyck In order to support page reporting it will be necessary to store and retrieve the migratetype of a page. To enable that I am moving the set and get operations for pcppage_migratetype into the mm/internal.h header so that they can be used outside of the page_alloc.c file. Signed-off-by: Alexander Duyck --- mm/internal.h | 18 ++++++++++++++++++ mm/page_alloc.c | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 0d5f720c75ab..e4a1a57bbd40 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -549,6 +549,24 @@ static inline bool is_migrate_highatomic_page(struct page *page) return get_pageblock_migratetype(page) == MIGRATE_HIGHATOMIC; } +/* + * A cached value of the page's pageblock's migratetype, used when the page is + * put on a pcplist. Used to avoid the pageblock migratetype lookup when + * freeing from pcplists in most cases, at the cost of possibly becoming stale. + * Also the migratetype set in the page does not necessarily match the pcplist + * index, e.g. page might have MIGRATE_CMA set but be on a pcplist with any + * other index - this ensures that it will be put on the correct CMA freelist. + */ +static inline int get_pcppage_migratetype(struct page *page) +{ + return page->index; +} + +static inline void set_pcppage_migratetype(struct page *page, int migratetype) +{ + page->index = migratetype; +} + void setup_zone_pageset(struct zone *zone); extern struct page *alloc_new_node_page(struct page *page, unsigned long node); #endif /* __MM_INTERNAL_H */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4e4356ba66c7..a791f2baeeeb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -185,24 +185,6 @@ static int __init early_init_on_free(char *buf) } early_param("init_on_free", early_init_on_free); -/* - * A cached value of the page's pageblock's migratetype, used when the page is - * put on a pcplist. Used to avoid the pageblock migratetype lookup when - * freeing from pcplists in most cases, at the cost of possibly becoming stale. - * Also the migratetype set in the page does not necessarily match the pcplist - * index, e.g. page might have MIGRATE_CMA set but be on a pcplist with any - * other index - this ensures that it will be put on the correct CMA freelist. - */ -static inline int get_pcppage_migratetype(struct page *page) -{ - return page->index; -} - -static inline void set_pcppage_migratetype(struct page *page, int migratetype) -{ - page->index = migratetype; -} - #ifdef CONFIG_PM_SLEEP /* * The following functions are used by the suspend/hibernate code to temporarily