mm: kmemleak: Don't require global debug options or debugfs

This allows kmemleak to function even when debugfs is globally disabled,
allowing kmemleak to give accurate results for CONFIG_DEBUG_FS=n.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2020-12-05 19:46:01 -08:00 committed by spakkkk
parent f83258abe2
commit 83a8040ba8
4 changed files with 12 additions and 4 deletions

View File

@ -123,7 +123,11 @@ obj-$(CONFIG_NILFS2_FS) += nilfs2/
obj-$(CONFIG_BEFS_FS) += befs/
obj-$(CONFIG_HOSTFS) += hostfs/
obj-$(CONFIG_CACHEFILES) += cachefiles/
obj-$(CONFIG_DEBUG_FS) += debugfs/
ifeq ($(CONFIG_DEBUG_FS),y)
obj-y += debugfs/
else
obj-$(CONFIG_DEBUG_KMEMLEAK) += debugfs/
endif
obj-$(CONFIG_TRACING) += tracefs/
obj-$(CONFIG_OCFS2_FS) += ocfs2/
obj-$(CONFIG_BTRFS_FS) += btrfs/

View File

@ -1,4 +1,7 @@
debugfs-objs := inode.o file.o
obj-$(CONFIG_DEBUG_FS) += debugfs.o
ifeq ($(CONFIG_DEBUG_KMEMLEAK),y)
ccflags-y := -DCONFIG_DEBUG_FS
endif
obj-y += debugfs.o

View File

@ -577,8 +577,7 @@ config HAVE_DEBUG_KMEMLEAK
config DEBUG_KMEMLEAK
bool "Kernel memory leak detector"
depends on DEBUG_KERNEL && HAVE_DEBUG_KMEMLEAK
select DEBUG_FS
depends on HAVE_DEBUG_KMEMLEAK
select STACKTRACE if STACKTRACE_SUPPORT
select KALLSYMS
select CRC32

View File

@ -109,3 +109,5 @@ obj-$(CONFIG_HARDENED_USERCOPY) += usercopy.o
obj-$(CONFIG_PERCPU_STATS) += percpu-stats.o
obj-$(CONFIG_HMM) += hmm.o
obj-$(CONFIG_MEMFD_CREATE) += memfd.o
CFLAGS_kmemleak.o += -DCONFIG_DEBUG_FS