dnl # Enabled by default it provides a minimal level of memory tracking.
dnl # A total count of bytes allocated is kept for each alloc and free.
dnl # Then at module unload time a report to the console will be printed
-dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
-dnl # and provide an easy way to inspect the kmem based slab.
+dnl # if memory was leaked.
dnl #
AC_DEFUN([SPL_AC_DEBUG_KMEM], [
AC_ARG_ENABLE([debug-kmem],
[AS_HELP_STRING([--enable-debug-kmem],
- [Enable basic kmem accounting @<:@default=yes@:>@])],
+ [Enable basic kmem accounting @<:@default=no@:>@])],
[],
- [enable_debug_kmem=yes])
+ [enable_debug_kmem=no])
AS_IF([test "x$enable_debug_kmem" = xyes],
[
typedef struct ctl_table spl_ctl_table;
#endif
-#ifdef DEBUG_KMEM
static unsigned long table_min = 0;
static unsigned long table_max = ~0;
-#endif
static struct ctl_table_header *spl_header = NULL;
static struct proc_dir_entry *proc_spl = NULL;
-#ifdef DEBUG_KMEM
static struct proc_dir_entry *proc_spl_kmem = NULL;
static struct proc_dir_entry *proc_spl_kmem_slab = NULL;
-#endif /* DEBUG_KMEM */
struct proc_dir_entry *proc_spl_kstat = NULL;
static int
return (rc);
}
+#endif /* DEBUG_KMEM */
static int
proc_doslab(struct ctl_table *table, int write,
return (rc);
}
-#endif /* DEBUG_KMEM */
static int
proc_dohostid(struct ctl_table *table, int write,
return (rc);
}
-#ifdef DEBUG_KMEM
static void
slab_seq_show_headers(struct seq_file *f)
{
.llseek = seq_lseek,
.release = seq_release,
};
-#endif /* DEBUG_KMEM */
-#ifdef DEBUG_KMEM
static struct ctl_table spl_kmem_table[] = {
+#ifdef DEBUG_KMEM
{
.procname = "kmem_used",
.data = &kmem_alloc_used,
.mode = 0444,
.proc_handler = &proc_doulongvec_minmax,
},
+#endif /* DEBUG_KMEM */
{
.procname = "slab_kmem_total",
.data = (void *)(KMC_KMEM | KMC_TOTAL),
},
{0},
};
-#endif /* DEBUG_KMEM */
static struct ctl_table spl_kstat_table[] = {
{0},
.mode = 0644,
.proc_handler = &proc_dohostid,
},
-#ifdef DEBUG_KMEM
{
.procname = "kmem",
.mode = 0555,
.child = spl_kmem_table,
},
-#endif
{
.procname = "kstat",
.mode = 0555,
goto out;
}
-#ifdef DEBUG_KMEM
proc_spl_kmem = proc_mkdir("kmem", proc_spl);
if (proc_spl_kmem == NULL) {
rc = -EUNATCH;
goto out;
}
-#endif /* DEBUG_KMEM */
-
proc_spl_kstat = proc_mkdir("kstat", proc_spl);
if (proc_spl_kstat == NULL) {
rc = -EUNATCH;
out:
if (rc) {
remove_proc_entry("kstat", proc_spl);
-#ifdef DEBUG_KMEM
remove_proc_entry("slab", proc_spl_kmem);
remove_proc_entry("kmem", proc_spl);
-#endif
remove_proc_entry("spl", NULL);
unregister_sysctl_table(spl_header);
}
spl_proc_fini(void)
{
remove_proc_entry("kstat", proc_spl);
-#ifdef DEBUG_KMEM
remove_proc_entry("slab", proc_spl_kmem);
remove_proc_entry("kmem", proc_spl);
-#endif
remove_proc_entry("spl", NULL);
ASSERT(spl_header != NULL);