Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3714144ybe; Sun, 8 Sep 2019 20:26:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjKu1Cr6N4g9oFYPzzv2E+8pBAlj7KuG96wpzqLijnCZIGibt4dJ8vxscV3vIl2VBv+e9v X-Received: by 2002:aa7:df1a:: with SMTP id c26mr21816838edy.106.1567999591187; Sun, 08 Sep 2019 20:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567999591; cv=none; d=google.com; s=arc-20160816; b=tabf6NT3VuM0OuHua9ofXPNtVJEXm1WMcQ/P5Z54E3GjfMJTgqlvsmVYbpr3KZHEv+ FDnbGWuk7FnQqXgvybbRyl0ZAbd6tk39YnUbqQDGwtAhP+8uCksMb5772JGssI8a/bFZ ahvzXcfIfDS3TWdUKVa0R6zV31ywh7QqbSSCa+oljFzlIY1nzqAvQky2c9pi7YTkZqC/ SizaV7xiRZY8J7fGy+BmPUwXU6m6su2GwHaFvtpvhVH3Z6yYonK9eA8NgNUTDhyIi66k IhsgNcd/voWrWKqQv7V4MuqkBOa1Brkr8+AhsOI4SRB029WMY22JAH6DlZjnMahwrgbo /zPA== 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=XeOFbkXePrFioXOb6FAIERJbwcp7KIiK2/+DoMA6rcA=; b=u3AVMVIE0VTJezhUILw3MPMd9PGe5daZ5wEU7vQ/ypjCbF+3Ytf+yEyCdokcCC8+6W isD2NV+AWKKWD5P2wcUjXxN20HycEwzVWqeWB4wEVr5UdweTfumtzbhBX76wiIy4auTK IF5caxb/w63Wp65kDDxjlHrE7jmn/2lfFN2OL+6Pd5svC62n3mmK3HPHT2CSOrQ92RB6 lqQajtH5e5SqKusqYe3DIv4ShRYW8B9JsN1KTNfMbNN0tcAjDugxJ8dkFUIdhY9//3Hq V11jlv/MrVmNu5vXnlEKG/pH25FiIPFk5mDdE+mWSOWMAsXH9gk9ND3zxIgs7p83GDkk 40+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rYZVLzjv; 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 z10si6603667ejx.208.2019.09.08.20.25.55; Sun, 08 Sep 2019 20:26:31 -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=rYZVLzjv; 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 S2395168AbfIGRZd (ORCPT + 99 others); Sat, 7 Sep 2019 13:25:33 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:33388 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395132AbfIGRZc (ORCPT ); Sat, 7 Sep 2019 13:25:32 -0400 Received: by mail-ot1-f68.google.com with SMTP id g25so7487883otl.0; Sat, 07 Sep 2019 10:25:32 -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=XeOFbkXePrFioXOb6FAIERJbwcp7KIiK2/+DoMA6rcA=; b=rYZVLzjvr5yE4QlzHHD82dZS2lBNT8G+0FQqFRdBYAjb/wKgN0lU5D1lBtoQWqfTjX aSCp6awRi7fd3X5kAvvuGccRdgGzZtxlICkGXwUikok0PX+w0BwbIa3SKAUzKWWokUeZ Qps21btfn9+VGyzAHOVRDS6z2Kqho67V64Mbajq6dDKkghbv6HLu8OoqaTF3ne8jpW/A uy6B4yNR064NWLAcd1nJqcMiDvCWIWDdSqgiAzUal7K14B5N6xMLv4F+4vPTHKSWOCJI Yzxr0oGW//qzZPv/1RcDfTKG18YRItPedk5lEVTeukfviAzCKHdYZIHdUFfHEbJsMsKs NGqQ== 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=XeOFbkXePrFioXOb6FAIERJbwcp7KIiK2/+DoMA6rcA=; b=iZ5RxXVNCI0/BBc3rdjamMZWh2Phquvvq+yMfAiVJCZ+ykON+yFQX4sIsLhE3NmDlU Pw95Z7zm4D3WyUhugsua91DOK3DZxKg+ncE1FrjOEk92lYPtCYKRcaY9NYm19EbhQvVv iECuPh0M3qJ3kFKouYvfsTRvve+k/6OeDvUztwgk3OSaPVBWd6ZBSfEVQyCwZ5zR2GXj HpxCC+fA3V/2lDPvtE3Wy+wees/uOLI6gr1ba7veg85rF08qamrz6jTRwqu3ZYEfGTFr qUXkqwAfCjOQNxtnj6p0rZuYY6gK79QlFVgqZ70R329H4ZOswrSGNPWVZUAWCew4QOv2 PyHQ== X-Gm-Message-State: APjAAAX1Ui9Oqx9FmWdhddVPE7TPagNzk4AdP8twlEmWOjtPOMyfXCa/ afFXrfv3oK69ptvVjPjY3aM= X-Received: by 2002:a9d:1921:: with SMTP id j33mr12440399ota.304.1567877131742; Sat, 07 Sep 2019 10:25:31 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id p28sm3582003oth.38.2019.09.07.10.25.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Sep 2019 10:25:31 -0700 (PDT) Subject: [PATCH v9 3/8] mm: Move set/get_pcppage_migratetype to mmzone.h From: Alexander Duyck To: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, mst@redhat.com, catalin.marinas@arm.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, will@kernel.org, linux-arm-kernel@lists.infradead.org, osalvador@suse.de Cc: yang.zhang.wz@gmail.com, pagupta@redhat.com, konrad.wilk@oracle.com, nitesh@redhat.com, riel@surriel.com, lcapitulino@redhat.com, wei.w.wang@intel.com, aarcange@redhat.com, ying.huang@intel.com, pbonzini@redhat.com, dan.j.williams@intel.com, fengguang.wu@intel.com, alexander.h.duyck@linux.intel.com, kirill.shutemov@linux.intel.com Date: Sat, 07 Sep 2019 10:25:28 -0700 Message-ID: <20190907172528.10910.37051.stgit@localhost.localdomain> In-Reply-To: <20190907172225.10910.34302.stgit@localhost.localdomain> References: <20190907172225.10910.34302.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. Reviewed-by: Dan Williams 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