projects/linux·blob master · refs

55 lines · 1.2 KiB

1// SPDX-License-Identifier: GPL-2.0
2// Copyright(c) 2018 Intel Corporation. All rights reserved.
3#ifndef _MM_SHUFFLE_H
4#define _MM_SHUFFLE_H
5
6#include <linux/jump_label.h>
7#include <linux/mmzone.h>
8
9#define SHUFFLE_ORDER MAX_PAGE_ORDER
10
11#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
12DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
13extern void __shuffle_free_memory(pg_data_t *pgdat);
14extern bool shuffle_pick_tail(void);
15static inline void __meminit shuffle_free_memory(pg_data_t *pgdat)
16{
17 if (!static_branch_unlikely(&page_alloc_shuffle_key))
18 return;
19 __shuffle_free_memory(pgdat);
20}
21
22extern void __shuffle_zone(struct zone *z);
23static inline void __meminit shuffle_zone(struct zone *z)
24{
25 if (!static_branch_unlikely(&page_alloc_shuffle_key))
26 return;
27 __shuffle_zone(z);
28}
29
30static inline bool is_shuffle_order(int order)
31{
32 if (!static_branch_unlikely(&page_alloc_shuffle_key))
33 return false;
34 return order >= SHUFFLE_ORDER;
35}
36#else
37static inline bool shuffle_pick_tail(void)
38{
39 return false;
40}
41
42static inline void shuffle_free_memory(pg_data_t *pgdat)
43{
44}
45
46static inline void shuffle_zone(struct zone *z)
47{
48}
49
50static inline bool is_shuffle_order(int order)
51{
52 return false;
53}
54#endif
55#endif /* _MM_SHUFFLE_H */