fix: function prototype in wrapper/mm.h
[lttng-modules.git] / wrapper / mm.h
1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2 *
3 * wrapper/mm.h
4 *
5 * Copyright (C) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
6 */
7
8 #ifndef _LTTNG_WRAPPER_MM_H
9 #define _LTTNG_WRAPPER_MM_H
10
11 #include <linux/mm.h>
12 #include <linux/oom.h>
13
14 #include <lttng-kernel-version.h>
15
16 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) \
17 || LTTNG_UBUNTU_KERNEL_RANGE(4,4,25,44, 4,5,0,0))
18
19 /*
20 * Returns true if the current estimation of the number of page available is
21 * larger than the number of pages passed as parameter.
22 */
23 static inline
24 bool wrapper_check_enough_free_pages(unsigned long num_pages)
25 {
26 return num_pages < si_mem_available();
27 }
28
29 #else
30
31 static inline
32 bool wrapper_check_enough_free_pages(unsigned long num_pages)
33 {
34 /*
35 * The si_mem_available function is not available on this kernel. Since
36 * we can't reliably know if there is enough memory available, so we
37 * return true.
38 */
39 return true;
40 }
41 #endif
42
43 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
44 static inline
45 void wrapper_set_current_oom_origin(void)
46 {
47 return set_current_oom_origin();
48 }
49
50 static inline
51 void wrapper_clear_current_oom_origin(void)
52 {
53 return clear_current_oom_origin();
54 }
55
56 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
57
58 static inline
59 void wrapper_set_current_oom_origin(void)
60 {
61 return;
62 }
63
64 static inline
65 void wrapper_clear_current_oom_origin(void)
66 {
67 return;
68 }
69 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
70 #endif /* _LTTNG_WRAPPER_MM_H */
This page took 0.029704 seconds and 4 git commands to generate.