1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
5 * Copyright (C) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
8 #ifndef _LTTNG_WRAPPER_MM_H
9 #define _LTTNG_WRAPPER_MM_H
12 #include <linux/oom.h>
14 #include <lttng-kernel-version.h>
16 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0) \
17 || LTTNG_UBUNTU_KERNEL_RANGE(4,4,25,44, 4,5,0,0))
20 * Returns true if the current estimation of the number of page available is
21 * larger than the number of pages passed as parameter.
24 bool wrapper_check_enough_free_pages(unsigned long num_pages
)
26 return num_pages
< si_mem_available();
32 bool wrapper_check_enough_free_pages(unsigned long num_pages
)
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
43 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
45 void wrapper_set_current_oom_origin(void)
47 return set_current_oom_origin();
51 void wrapper_clear_current_oom_origin(void)
53 return clear_current_oom_origin();
56 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) */
59 void wrapper_set_current_oom_origin(void)
65 void wrapper_clear_current_oom_origin(void)
69 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) */
70 #endif /* _LTTNG_WRAPPER_MM_H */
This page took 0.042361 seconds and 4 git commands to generate.