Blame view

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