From: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx> --- 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); } /*