]>
Commit | Line | Data |
---|---|---|
a9125891 BB |
1 | dnl # |
2 | dnl # Enabled by default it provides a minimal level of memory tracking. | |
3 | dnl # A total count of bytes allocated is kept for each alloc and free. | |
4 | dnl # Then at module unload time a report to the console will be printed | |
5 | dnl # if memory was leaked. | |
6 | dnl # | |
7 | AC_DEFUN([SPL_AC_DEBUG_KMEM], [ | |
8 | AC_ARG_ENABLE([debug-kmem], | |
9 | [AS_HELP_STRING([--enable-debug-kmem], | |
10 | [Enable basic kmem accounting @<:@default=no@:>@])], | |
11 | [], | |
12 | [enable_debug_kmem=no]) | |
13 | ||
14 | AS_IF([test "x$enable_debug_kmem" = xyes], | |
15 | [ | |
16 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" | |
17 | DEBUG_KMEM="_with_debug_kmem" | |
18 | AC_DEFINE([DEBUG_KMEM], [1], | |
19 | [Define to 1 to enable basic kmem accounting]) | |
20 | ], [ | |
21 | DEBUG_KMEM="_without_debug_kmem" | |
22 | ]) | |
23 | ||
24 | AC_SUBST(DEBUG_KMEM) | |
25 | AC_MSG_CHECKING([whether basic kmem accounting is enabled]) | |
26 | AC_MSG_RESULT([$enable_debug_kmem]) | |
27 | ]) | |
28 | ||
29 | dnl # | |
30 | dnl # Disabled by default it provides detailed memory tracking. This | |
31 | dnl # feature also requires --enable-debug-kmem to be set. When enabled | |
32 | dnl # not only will total bytes be tracked but also the location of every | |
33 | dnl # alloc and free. When the SPL module is unloaded a list of all leaked | |
34 | dnl # addresses and where they were allocated will be dumped to the console. | |
35 | dnl # Enabling this feature has a significant impact on performance but it | |
36 | dnl # makes finding memory leaks pretty straight forward. | |
37 | dnl # | |
38 | AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [ | |
39 | AC_ARG_ENABLE([debug-kmem-tracking], | |
40 | [AS_HELP_STRING([--enable-debug-kmem-tracking], | |
41 | [Enable detailed kmem tracking @<:@default=no@:>@])], | |
42 | [], | |
43 | [enable_debug_kmem_tracking=no]) | |
44 | ||
45 | AS_IF([test "x$enable_debug_kmem_tracking" = xyes], | |
46 | [ | |
47 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING" | |
48 | DEBUG_KMEM_TRACKING="_with_debug_kmem_tracking" | |
49 | AC_DEFINE([DEBUG_KMEM_TRACKING], [1], | |
50 | [Define to 1 to enable detailed kmem tracking]) | |
51 | ], [ | |
52 | DEBUG_KMEM_TRACKING="_without_debug_kmem_tracking" | |
53 | ]) | |
54 | ||
55 | AC_SUBST(DEBUG_KMEM_TRACKING) | |
56 | AC_MSG_CHECKING([whether detailed kmem tracking is enabled]) | |
57 | AC_MSG_RESULT([$enable_debug_kmem_tracking]) | |
58 | ]) | |
66955885 MN |
59 | |
60 | dnl # | |
61 | dnl # 4.12 API, | |
62 | dnl # Added kvmalloc allocation strategy | |
63 | dnl # | |
64 | AC_DEFUN([ZFS_AC_KERNEL_SRC_KVMALLOC], [ | |
65 | ZFS_LINUX_TEST_SRC([kvmalloc], [ | |
66 | #include <linux/mm.h> | |
e86f88aa | 67 | #include <linux/slab.h> |
66955885 MN |
68 | ],[ |
69 | void *p __attribute__ ((unused)); | |
70 | ||
71 | p = kvmalloc(0, GFP_KERNEL); | |
72 | ]) | |
73 | ]) | |
74 | ||
75 | AC_DEFUN([ZFS_AC_KERNEL_KVMALLOC], [ | |
76 | AC_MSG_CHECKING([whether kvmalloc(ptr, flags) is available]) | |
77 | ZFS_LINUX_TEST_RESULT([kvmalloc], [ | |
78 | AC_MSG_RESULT(yes) | |
79 | AC_DEFINE(HAVE_KVMALLOC, 1, [kvmalloc exists]) | |
80 | ],[ | |
81 | AC_MSG_RESULT(no) | |
82 | ]) | |
83 | ]) | |
080102a1 MN |
84 | |
85 | dnl # | |
86 | dnl # 5.8 API, | |
87 | dnl # __vmalloc PAGE_KERNEL removal | |
88 | dnl # | |
89 | AC_DEFUN([ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL], [ | |
90 | ZFS_LINUX_TEST_SRC([__vmalloc], [ | |
91 | #include <linux/mm.h> | |
92 | #include <linux/vmalloc.h> | |
93 | ],[ | |
94 | void *p __attribute__ ((unused)); | |
95 | ||
96 | p = __vmalloc(0, GFP_KERNEL, PAGE_KERNEL); | |
97 | ]) | |
98 | ]) | |
99 | ||
100 | AC_DEFUN([ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL], [ | |
101 | AC_MSG_CHECKING([whether __vmalloc(ptr, flags, pageflags) is available]) | |
102 | ZFS_LINUX_TEST_RESULT([__vmalloc], [ | |
103 | AC_MSG_RESULT(yes) | |
104 | AC_DEFINE(HAVE_VMALLOC_PAGE_KERNEL, 1, [__vmalloc page flags exists]) | |
105 | ],[ | |
106 | AC_MSG_RESULT(no) | |
107 | ]) | |
108 | ]) | |
109 | - |