]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - mm/shuffle.h
mm, memcg: decouple e{low,min} state mutations from protection checks
[mirror_ubuntu-jammy-kernel.git] / mm / shuffle.h
CommitLineData
e900a918
DW
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#include <linux/jump_label.h>
6
7/*
8 * SHUFFLE_ENABLE is called from the command line enabling path, or by
9 * platform-firmware enabling that indicates the presence of a
10 * direct-mapped memory-side-cache. SHUFFLE_FORCE_DISABLE is called from
11 * the command line path and overrides any previous or future
12 * SHUFFLE_ENABLE.
13 */
14enum mm_shuffle_ctl {
15 SHUFFLE_ENABLE,
16 SHUFFLE_FORCE_DISABLE,
17};
18
19#define SHUFFLE_ORDER (MAX_ORDER-1)
20
21#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
22DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
23extern void page_alloc_shuffle(enum mm_shuffle_ctl ctl);
24extern void __shuffle_free_memory(pg_data_t *pgdat);
a2129f24 25extern bool shuffle_pick_tail(void);
e900a918
DW
26static inline void shuffle_free_memory(pg_data_t *pgdat)
27{
28 if (!static_branch_unlikely(&page_alloc_shuffle_key))
29 return;
30 __shuffle_free_memory(pgdat);
31}
32
33extern void __shuffle_zone(struct zone *z);
34static inline void shuffle_zone(struct zone *z)
35{
36 if (!static_branch_unlikely(&page_alloc_shuffle_key))
37 return;
38 __shuffle_zone(z);
39}
97500a4a
DW
40
41static inline bool is_shuffle_order(int order)
42{
43 if (!static_branch_unlikely(&page_alloc_shuffle_key))
44 return false;
45 return order >= SHUFFLE_ORDER;
46}
e900a918 47#else
a2129f24
AD
48static inline bool shuffle_pick_tail(void)
49{
50 return false;
51}
52
e900a918
DW
53static inline void shuffle_free_memory(pg_data_t *pgdat)
54{
55}
56
57static inline void shuffle_zone(struct zone *z)
58{
59}
60
61static inline void page_alloc_shuffle(enum mm_shuffle_ctl ctl)
62{
63}
97500a4a
DW
64
65static inline bool is_shuffle_order(int order)
66{
67 return false;
68}
e900a918
DW
69#endif
70#endif /* _MM_SHUFFLE_H */