Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp474950ybi; Thu, 1 Aug 2019 22:52:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3MY/dST5tQ1Tpi/P/knpzclmb/KStPTK6clZvSZf4YvFe/XwV3kxLOyOc9qpOO++GAIP+ X-Received: by 2002:a17:902:9a06:: with SMTP id v6mr126105740plp.71.1564725165787; Thu, 01 Aug 2019 22:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564725165; cv=none; d=google.com; s=arc-20160816; b=PctRhbrtOc1Jdedzl51qnkzO9nxqgpK7CwwSaoL4+iHp7wMVMkT4UaJGcnFFOzK5CM jg3+3zWyhXUZwxtU42yDZvpzoJ9PHznhLobl/5miyERTeKCQvaOmxbny+8Ebu0oXyXtd tgjwEP1y3b5ZfgUC8c8uwas9RFd5vhLOag138Ji32U7bcLF4apd+wc2afQo5U6MamWg+ K3dV7kYhw+wt3lRvfsvq4g8ske5qfP72ylRCZufEUn/LEIvHHULiHNP4LQMlMLzNmDDw GnPBRG47Wf/kf0Srt0EeoSWF/VJQ/ozWbLZd4QzC7gqpgAA67wIJ9fFmFylIfNNIDDac oItQ== 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=49QRQWf2FNsjOXVM5hrSB1/wT6sFBWj2i81LIQFGLg0=; b=W57FCvar5MhkP11HU9mu2FLsvTnzh4ptwnRnjvH3mekA1ORoHHXwvHbS6MH37edJfe XkkWgUh2ePk79j9gTqepQ2UhYqF0jGwazgmWQZSzpl0oeT4DbTJyKhE1/Avmc45oShVN Ni8XKUXf3UZuO0LBVAzSmEpSHvR0Jvq0uMF2Gpp6oG4Dq93r1PT4lJ5p4IJqn3IqzY8k xo5AGXS2c6GOp/qT5SbEGmIsa0tx0GRXwxhFDFZxaZLOUndPfl4WRooSa855n3R1B7qT ag3aSbLE+6J6Q/GJfLxsDdwoS/b8IYL1ao2PDT2hzUwdhalO3wSTEMwhAO7TbHSBvMyK V5tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ji33itet; 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 b20si37739744pfo.108.2019.08.01.22.52.30; Thu, 01 Aug 2019 22:52:45 -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=ji33itet; 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 S1731420AbfHAWbk (ORCPT + 99 others); Thu, 1 Aug 2019 18:31:40 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46578 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727498AbfHAWbk (ORCPT ); Thu, 1 Aug 2019 18:31:40 -0400 Received: by mail-pl1-f195.google.com with SMTP id c2so32785398plz.13; Thu, 01 Aug 2019 15:31:39 -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=49QRQWf2FNsjOXVM5hrSB1/wT6sFBWj2i81LIQFGLg0=; b=ji33itetIIDF6723/1Y8YKJGaXsZhwxdfFFZT45WUtDznubVlVgr6z8O6LM2Y0Bm8P P43KwP1bs6fuGWQAelVx2jsf+HXc9hjzhGqb6BID3daGICPkxx/rJvFHx5nyJeTqaquo J5birZo4hMpfVK6j0Z9nSIcOOGAxTZryiD/Bg7Ea0Sh4JYUZV5Q8A5i5BlFn+XlDUn2Y xbtmEccIS9ctv1SzHpgWS+Gmvdsmo1e/yOMrR/P+7j5Dc6t3T1NV9Bf8oF0an0BTRzHE zwVYl7CMWW7OMqTK+UidQdCn5nY8fJS9gYQXsiGqTJOK0Pc7c31igD37NF4ruL1MGqIV abHw== 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=49QRQWf2FNsjOXVM5hrSB1/wT6sFBWj2i81LIQFGLg0=; b=n9jK1X8KYXR0qVYxL4mgYzoR7+hPt3qIlbfhNA9uCoj0U1Yur6Hzq9J422+PTJR/ys YEevjDguYIYx3kVI4MP5lHP5F+hj19AIvkK4zONfMGtzJLVAbq8VOGoL3f/TH2yZrq5X 4Na0G4NhvEr7EbpdWY7wD6yIwCEvblY+L7Yhi6Q1VjxJ94o6jaIonGxRo9YuGEQ0gTjS /lTfw9yEvfY3QiaBzpD4lLSgdm8b+aGcYZBbZsBGFW+IIrApnlJrB2ZWnLkrsk80Acez 0Ujie7tKrRDdQvKfxwIltpEVAuPv2/X+N7QCF3Wv1LXN6w42RqrJ8o9PGPHvZYUpb017 iEQA== X-Gm-Message-State: APjAAAUS+TC+hizhmTyPTw1DzUQfN4ueZHqOAHE8y09nwXXeoQay5hJr jtrVQKiNrY/hdfGKNK3d/RzjWS0u X-Received: by 2002:a17:902:2be6:: with SMTP id l93mr129298797plb.0.1564698699193; Thu, 01 Aug 2019 15:31:39 -0700 (PDT) Received: from localhost.localdomain (50-39-177-61.bvtn.or.frontiernet.net. [50.39.177.61]) by smtp.gmail.com with ESMTPSA id m20sm80514167pff.79.2019.08.01.15.31.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Aug 2019 15:31:38 -0700 (PDT) Subject: [PATCH v3 2/6] mm: Move set/get_pcppage_migratetype to mmzone.h From: Alexander Duyck To: nitesh@redhat.com, kvm@vger.kernel.org, david@redhat.com, mst@redhat.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org Cc: yang.zhang.wz@gmail.com, pagupta@redhat.com, riel@surriel.com, konrad.wilk@oracle.com, willy@infradead.org, 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: Thu, 01 Aug 2019 15:29:26 -0700 Message-ID: <20190801222926.22190.81982.stgit@localhost.localdomain> In-Reply-To: <20190801222158.22190.96964.stgit@localhost.localdomain> References: <20190801222158.22190.96964.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 aeration 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 dfed182f200d..7cedc73953fd 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