Commit | Line | Data |
---|---|---|
9f36eaed MJ |
1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
2 | * | |
389d7070 MD |
3 | * wrapper/page_alloc.h |
4 | * | |
5 | * wrapper around get_pfnblock_flags_mask. Using KALLSYMS to get its address | |
6 | * when available, else we need to have a kernel that exports this function to | |
7 | * GPL modules. | |
8 | * | |
9 | * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
389d7070 MD |
10 | */ |
11 | ||
9f36eaed MJ |
12 | #ifndef _LTTNG_WRAPPER_PAGE_ALLOC_H |
13 | #define _LTTNG_WRAPPER_PAGE_ALLOC_H | |
14 | ||
5a2f5e92 | 15 | #include <lttng-kernel-version.h> |
389d7070 MD |
16 | |
17 | /* | |
18 | * We need to redefine get_pfnblock_flags_mask to our wrapper, because | |
19 | * the get_pageblock_migratetype() macro uses it. | |
20 | */ | |
ffc696db | 21 | #if (defined(CONFIG_KALLSYMS) \ |
2d042821 | 22 | && (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,19,2) \ |
36561775 MD |
23 | || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \ |
24 | || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \ | |
397c12b4 MD |
25 | || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \ |
26 | || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))) | |
389d7070 MD |
27 | |
28 | #define get_pfnblock_flags_mask wrapper_get_pfnblock_flags_mask | |
29 | ||
30 | #include <linux/mm_types.h> | |
31 | ||
32 | int wrapper_get_pfnblock_flags_mask_init(void); | |
33 | ||
0e14d6e7 | 34 | #else |
389d7070 MD |
35 | |
36 | #include <linux/mm_types.h> | |
37 | ||
38 | static inline | |
39 | int wrapper_get_pfnblock_flags_mask_init(void) | |
40 | { | |
41 | return 0; | |
42 | } | |
43 | ||
0e14d6e7 MD |
44 | #endif |
45 | ||
46 | /* | |
47 | * For a specific range of Ubuntu 3.13 kernels, we need to redefine | |
48 | * get_pageblock_flags_mask to our wrapper, because the | |
49 | * get_pageblock_migratetype() macro uses it. This function has been | |
50 | * introduced into mainline within commit | |
51 | * e58469bafd0524e848c3733bc3918d854595e20f, but never actually showed | |
52 | * up in a stable kernel version, since it has been changed by commit | |
53 | * dc4b0caff24d9b2918e9f27bc65499ee63187eba. Since Ubuntu chose to only | |
54 | * backport the former commit but not the latter, we need to do a | |
55 | * special case to cover this. | |
56 | */ | |
57 | #if (defined(CONFIG_KALLSYMS) \ | |
58 | && LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0)) | |
59 | ||
60 | #define get_pageblock_flags_mask wrapper_get_pageblock_flags_mask | |
61 | ||
62 | #include <linux/mm_types.h> | |
63 | ||
64 | int wrapper_get_pageblock_flags_mask_init(void); | |
65 | ||
66 | #else | |
67 | ||
68 | #include <linux/mm_types.h> | |
69 | ||
70 | static inline | |
71 | int wrapper_get_pageblock_flags_mask_init(void) | |
72 | { | |
73 | return 0; | |
74 | } | |
75 | ||
76 | #endif | |
389d7070 MD |
77 | |
78 | #endif /* _LTTNG_WRAPPER_PAGE_ALLOC_H */ |