diff --git a/fs/Makefile b/fs/Makefile index c62198e859d7..290716863adb 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -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/ diff --git a/fs/debugfs/Makefile b/fs/debugfs/Makefile index 840c45696668..a1f5982cd771 100644 --- a/fs/debugfs/Makefile +++ b/fs/debugfs/Makefile @@ -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 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index bc1a92af72a8..3583e9d5e5d0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -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 diff --git a/mm/Makefile b/mm/Makefile index 9b0a45f4651b..afcbe4b9ef51 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -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