162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci// Copyright(c) 2018 Intel Corporation. All rights reserved. 362306a36Sopenharmony_ci#ifndef _MM_SHUFFLE_H 462306a36Sopenharmony_ci#define _MM_SHUFFLE_H 562306a36Sopenharmony_ci#include <linux/jump_label.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define SHUFFLE_ORDER MAX_ORDER 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR 1062306a36Sopenharmony_ciDECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key); 1162306a36Sopenharmony_ciextern void __shuffle_free_memory(pg_data_t *pgdat); 1262306a36Sopenharmony_ciextern bool shuffle_pick_tail(void); 1362306a36Sopenharmony_cistatic inline void __meminit shuffle_free_memory(pg_data_t *pgdat) 1462306a36Sopenharmony_ci{ 1562306a36Sopenharmony_ci if (!static_branch_unlikely(&page_alloc_shuffle_key)) 1662306a36Sopenharmony_ci return; 1762306a36Sopenharmony_ci __shuffle_free_memory(pgdat); 1862306a36Sopenharmony_ci} 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciextern void __shuffle_zone(struct zone *z); 2162306a36Sopenharmony_cistatic inline void __meminit shuffle_zone(struct zone *z) 2262306a36Sopenharmony_ci{ 2362306a36Sopenharmony_ci if (!static_branch_unlikely(&page_alloc_shuffle_key)) 2462306a36Sopenharmony_ci return; 2562306a36Sopenharmony_ci __shuffle_zone(z); 2662306a36Sopenharmony_ci} 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_cistatic inline bool is_shuffle_order(int order) 2962306a36Sopenharmony_ci{ 3062306a36Sopenharmony_ci if (!static_branch_unlikely(&page_alloc_shuffle_key)) 3162306a36Sopenharmony_ci return false; 3262306a36Sopenharmony_ci return order >= SHUFFLE_ORDER; 3362306a36Sopenharmony_ci} 3462306a36Sopenharmony_ci#else 3562306a36Sopenharmony_cistatic inline bool shuffle_pick_tail(void) 3662306a36Sopenharmony_ci{ 3762306a36Sopenharmony_ci return false; 3862306a36Sopenharmony_ci} 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_cistatic inline void shuffle_free_memory(pg_data_t *pgdat) 4162306a36Sopenharmony_ci{ 4262306a36Sopenharmony_ci} 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_cistatic inline void shuffle_zone(struct zone *z) 4562306a36Sopenharmony_ci{ 4662306a36Sopenharmony_ci} 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_cistatic inline bool is_shuffle_order(int order) 4962306a36Sopenharmony_ci{ 5062306a36Sopenharmony_ci return false; 5162306a36Sopenharmony_ci} 5262306a36Sopenharmony_ci#endif 5362306a36Sopenharmony_ci#endif /* _MM_SHUFFLE_H */ 54