linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] kmemleak-test: Optimize kmemleak_test.c build flow
@ 2023-03-30  6:09 Hao Ge
  2023-03-30 20:10 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Ge @ 2023-03-30  6:09 UTC (permalink / raw)
  To: akpm, alex.williamson, jgg, akrowiak, arnd, mark.rutland,
	ye.xingchen, ojeda, alex.gaynor, me, gregkh
  Cc: linux-mm, linux-kernel, gehao618, Hao Ge

Now kmemleak-test.c is moved to samples directory,
if CONFIG_DEBUG_KMEMLEAK_TEST=m,but CONFIG_SAMPLES
is not set,it will be meaningless.

So we will remove CONFIG_DEBUG_KMEMLEAK_TEST and
add CONFIG_SAMPLE_KMEMLEAK which in samples directory
to control kmemleak-test.c build or not

Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 mm/Kconfig.debug          | 8 --------
 samples/Kconfig           | 7 +++++++
 samples/Makefile          | 2 +-
 samples/kmemleak/Makefile | 2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
index c3547a373c9c..fb86e9952bac 100644
--- a/mm/Kconfig.debug
+++ b/mm/Kconfig.debug
@@ -249,14 +249,6 @@ config DEBUG_KMEMLEAK_MEM_POOL_SIZE
 	  fully initialised, this memory pool acts as an emergency one
 	  if slab allocations fail.
 
-config DEBUG_KMEMLEAK_TEST
-	tristate "Simple test for the kernel memory leak detector"
-	depends on DEBUG_KMEMLEAK && m
-	help
-	  This option enables a module that explicitly leaks memory.
-
-	  If unsure, say N.
-
 config DEBUG_KMEMLEAK_DEFAULT_OFF
 	bool "Default kmemleak to off"
 	depends on DEBUG_KMEMLEAK
diff --git a/samples/Kconfig b/samples/Kconfig
index 30ef8bd48ba3..69076fbf3298 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -273,6 +273,13 @@ config SAMPLE_CORESIGHT_SYSCFG
 	  This demonstrates how a user may create their own CoreSight
 	  configurations and easily load them into the system at runtime.
 
+config SAMPLE_KMEMLEAK
+        tristate "Simple test for the kernel memory leak detector"
+        depends on DEBUG_KMEMLEAK && m
+        help
+          Build a sample program which have explicitly leaks memory to test
+          kmemleak
+
 source "samples/rust/Kconfig"
 
 endif # SAMPLES
diff --git a/samples/Makefile b/samples/Makefile
index 7cb632ef88ee..7727f1a0d6d1 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -33,7 +33,7 @@ subdir-$(CONFIG_SAMPLE_VFS)		+= vfs
 obj-$(CONFIG_SAMPLE_INTEL_MEI)		+= mei/
 subdir-$(CONFIG_SAMPLE_WATCHDOG)	+= watchdog
 subdir-$(CONFIG_SAMPLE_WATCH_QUEUE)	+= watch_queue
-obj-$(CONFIG_DEBUG_KMEMLEAK_TEST)	+= kmemleak/
+obj-$(CONFIG_SAMPLE_KMEMLEAK)		+= kmemleak/
 obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG)	+= coresight/
 obj-$(CONFIG_SAMPLE_FPROBE)		+= fprobe/
 obj-$(CONFIG_SAMPLES_RUST)		+= rust/
diff --git a/samples/kmemleak/Makefile b/samples/kmemleak/Makefile
index 16b6132c540c..8a999ab43b6d 100644
--- a/samples/kmemleak/Makefile
+++ b/samples/kmemleak/Makefile
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak-test.o
+obj-$(CONFIG_SAMPLE_KMEMLEAK) += kmemleak-test.o
-- 
2.25.1


No virus found
		Checked by Hillstone Network AntiVirus


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-30 20:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  6:09 [RESEND PATCH] kmemleak-test: Optimize kmemleak_test.c build flow Hao Ge
2023-03-30 20:10 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox