[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190530215455.13974.87717.stgit@localhost.localdomain>
Date: Thu, 30 May 2019 14:54:55 -0700
From: Alexander Duyck <alexander.duyck@...il.com>
To: nitesh@...hat.com, kvm@...r.kernel.org, david@...hat.com,
mst@...hat.com, dave.hansen@...el.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: yang.zhang.wz@...il.com, pagupta@...hat.com, riel@...riel.com,
konrad.wilk@...cle.com, lcapitulino@...hat.com,
wei.w.wang@...el.com, aarcange@...hat.com, pbonzini@...hat.com,
dan.j.williams@...el.com, alexander.h.duyck@...ux.intel.com
Subject: [RFC PATCH 11/11] mm: Add free page notification hook
From: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
Add a hook so that we are notified when a new page is available. We will
use this hook to notify the virtio aeration system when we have achieved
enough free higher-order pages to justify the process of pulling some pages
and hinting on them.
Signed-off-by: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
---
arch/x86/include/asm/page.h | 11 +++++++++++
include/linux/gfp.h | 4 ++++
mm/page_alloc.c | 2 ++
3 files changed, 17 insertions(+)
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
index 7555b48803a8..dfd546230120 100644
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -18,6 +18,17 @@
struct page;
+#ifdef CONFIG_AERATION
+#include <linux/memory_aeration.h>
+
+#define HAVE_ARCH_FREE_PAGE_NOTIFY
+static inline void
+arch_free_page_notify(struct page *page, struct zone *zone, int order)
+{
+ aerator_notify_free(page, zone, order);
+}
+
+#endif
#include <linux/range.h>
extern struct range pfn_mapped[];
extern int nr_pfn_mapped;
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 407a089d861f..d975e7eabbf8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -459,6 +459,10 @@ static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
#ifndef HAVE_ARCH_FREE_PAGE
static inline void arch_free_page(struct page *page, int order) { }
#endif
+#ifndef HAVE_ARCH_FREE_PAGE_NOTIFY
+static inline void
+arch_free_page_notify(struct page *page, struct zone *zone, int order) { }
+#endif
#ifndef HAVE_ARCH_ALLOC_PAGE
static inline void arch_alloc_page(struct page *page, int order) { }
#endif
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e3800221414b..104763034ce3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -999,6 +999,8 @@ static inline void __free_one_page(struct page *page,
add_to_free_area_tail(page, area, migratetype);
else
add_to_free_area(page, area, migratetype);
+
+ arch_free_page_notify(page, zone, order);
}
/*
Powered by blists - more mailing lists