Fix: update writeback instrumentation for kernel 4.14
[lttng-modules.git] / wrapper / page_alloc.h
CommitLineData
389d7070
MD
1#ifndef _LTTNG_WRAPPER_PAGE_ALLOC_H
2#define _LTTNG_WRAPPER_PAGE_ALLOC_H
3
4/*
5 * wrapper/page_alloc.h
6 *
7 * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address
8 * when available, else we need to have a kernel that exports this function to
9 * GPL modules.
10 *
11 * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; only
16 * version 2.1 of the License.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27
5a2f5e92 28#include <lttng-kernel-version.h>
389d7070
MD
29
30/*
31 * We need to redefine get_pfnblock_flags_mask to our wrapper, because
32 * the get_pageblock_migratetype() macro uses it.
33 */
ffc696db 34#if (defined(CONFIG_KALLSYMS) \
36561775
MD
35 && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
36 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
37 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
397c12b4
MD
38 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
39 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0)))
389d7070
MD
40
41#define get_pfnblock_flags_mask wrapper_get_pfnblock_flags_mask
42
43#include <linux/mm_types.h>
44
45int wrapper_get_pfnblock_flags_mask_init(void);
46
0e14d6e7 47#else
389d7070
MD
48
49#include <linux/mm_types.h>
50
51static inline
52int wrapper_get_pfnblock_flags_mask_init(void)
53{
54 return 0;
55}
56
0e14d6e7
MD
57#endif
58
59/*
60 * For a specific range of Ubuntu 3.13 kernels, we need to redefine
61 * get_pageblock_flags_mask to our wrapper, because the
62 * get_pageblock_migratetype() macro uses it. This function has been
63 * introduced into mainline within commit
64 * e58469bafd0524e848c3733bc3918d854595e20f, but never actually showed
65 * up in a stable kernel version, since it has been changed by commit
66 * dc4b0caff24d9b2918e9f27bc65499ee63187eba. Since Ubuntu chose to only
67 * backport the former commit but not the latter, we need to do a
68 * special case to cover this.
69 */
70#if (defined(CONFIG_KALLSYMS) \
71 && LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0))
72
73#define get_pageblock_flags_mask wrapper_get_pageblock_flags_mask
74
75#include <linux/mm_types.h>
76
77int wrapper_get_pageblock_flags_mask_init(void);
78
79#else
80
81#include <linux/mm_types.h>
82
83static inline
84int wrapper_get_pageblock_flags_mask_init(void)
85{
86 return 0;
87}
88
89#endif
389d7070
MD
90
91#endif /* _LTTNG_WRAPPER_PAGE_ALLOC_H */
This page took 0.02899 seconds and 4 git commands to generate.