Drop support for kernels < 4.4 from 'wrapper/mm.h'
[lttng-modules.git] / include / wrapper / mm.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
7502f47a
FD
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
2df37e95 14#include <lttng/kernel-version.h>
7502f47a 15
5f4c791e 16#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0) \
7502f47a
FD
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 */
23static inline
24bool wrapper_check_enough_free_pages(unsigned long num_pages)
25{
26 return num_pages < si_mem_available();
27}
28
29#else
30
31static inline
32bool 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
7502f47a 43#endif /* _LTTNG_WRAPPER_MM_H */
This page took 0.040198 seconds and 4 git commands to generate.