1e900a918SDan Williams // SPDX-License-Identifier: GPL-2.0 2e900a918SDan Williams // Copyright(c) 2018 Intel Corporation. All rights reserved. 3e900a918SDan Williams #ifndef _MM_SHUFFLE_H 4e900a918SDan Williams #define _MM_SHUFFLE_H 5e900a918SDan Williams #include <linux/jump_label.h> 6e900a918SDan Williams 7*23baf831SKirill A. Shutemov #define SHUFFLE_ORDER MAX_ORDER 8e900a918SDan Williams 9e900a918SDan Williams #ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR 10e900a918SDan Williams DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key); 11e900a918SDan Williams extern void __shuffle_free_memory(pg_data_t *pgdat); 12a2129f24SAlexander Duyck extern bool shuffle_pick_tail(void); shuffle_free_memory(pg_data_t * pgdat)13f9f74dc2SArnd Bergmannstatic inline void __meminit shuffle_free_memory(pg_data_t *pgdat) 14e900a918SDan Williams { 15e900a918SDan Williams if (!static_branch_unlikely(&page_alloc_shuffle_key)) 16e900a918SDan Williams return; 17e900a918SDan Williams __shuffle_free_memory(pgdat); 18e900a918SDan Williams } 19e900a918SDan Williams 20e900a918SDan Williams extern void __shuffle_zone(struct zone *z); shuffle_zone(struct zone * z)21f9f74dc2SArnd Bergmannstatic inline void __meminit shuffle_zone(struct zone *z) 22e900a918SDan Williams { 23e900a918SDan Williams if (!static_branch_unlikely(&page_alloc_shuffle_key)) 24e900a918SDan Williams return; 25e900a918SDan Williams __shuffle_zone(z); 26e900a918SDan Williams } 2797500a4aSDan Williams is_shuffle_order(int order)2897500a4aSDan Williamsstatic inline bool is_shuffle_order(int order) 2997500a4aSDan Williams { 3097500a4aSDan Williams if (!static_branch_unlikely(&page_alloc_shuffle_key)) 3197500a4aSDan Williams return false; 3297500a4aSDan Williams return order >= SHUFFLE_ORDER; 3397500a4aSDan Williams } 34e900a918SDan Williams #else shuffle_pick_tail(void)35a2129f24SAlexander Duyckstatic inline bool shuffle_pick_tail(void) 36a2129f24SAlexander Duyck { 37a2129f24SAlexander Duyck return false; 38a2129f24SAlexander Duyck } 39a2129f24SAlexander Duyck shuffle_free_memory(pg_data_t * pgdat)40e900a918SDan Williamsstatic inline void shuffle_free_memory(pg_data_t *pgdat) 41e900a918SDan Williams { 42e900a918SDan Williams } 43e900a918SDan Williams shuffle_zone(struct zone * z)44e900a918SDan Williamsstatic inline void shuffle_zone(struct zone *z) 45e900a918SDan Williams { 46e900a918SDan Williams } 47e900a918SDan Williams is_shuffle_order(int order)4897500a4aSDan Williamsstatic inline bool is_shuffle_order(int order) 4997500a4aSDan Williams { 5097500a4aSDan Williams return false; 5197500a4aSDan Williams } 52e900a918SDan Williams #endif 53e900a918SDan Williams #endif /* _MM_SHUFFLE_H */ 54