Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 // Copyright(c) 2018 Intel Corporation. All rights reserved.
0003 #ifndef _MM_SHUFFLE_H
0004 #define _MM_SHUFFLE_H
0005 #include <linux/jump_label.h>
0006 
0007 #define SHUFFLE_ORDER (MAX_ORDER-1)
0008 
0009 #ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
0010 DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
0011 extern void __shuffle_free_memory(pg_data_t *pgdat);
0012 extern bool shuffle_pick_tail(void);
0013 static inline void __meminit shuffle_free_memory(pg_data_t *pgdat)
0014 {
0015     if (!static_branch_unlikely(&page_alloc_shuffle_key))
0016         return;
0017     __shuffle_free_memory(pgdat);
0018 }
0019 
0020 extern void __shuffle_zone(struct zone *z);
0021 static inline void __meminit shuffle_zone(struct zone *z)
0022 {
0023     if (!static_branch_unlikely(&page_alloc_shuffle_key))
0024         return;
0025     __shuffle_zone(z);
0026 }
0027 
0028 static inline bool is_shuffle_order(int order)
0029 {
0030     if (!static_branch_unlikely(&page_alloc_shuffle_key))
0031         return false;
0032     return order >= SHUFFLE_ORDER;
0033 }
0034 #else
0035 static inline bool shuffle_pick_tail(void)
0036 {
0037     return false;
0038 }
0039 
0040 static inline void shuffle_free_memory(pg_data_t *pgdat)
0041 {
0042 }
0043 
0044 static inline void shuffle_zone(struct zone *z)
0045 {
0046 }
0047 
0048 static inline bool is_shuffle_order(int order)
0049 {
0050     return false;
0051 }
0052 #endif
0053 #endif /* _MM_SHUFFLE_H */