From patchwork Wed Jan 18 02:35:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13105422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3B4BC00A5A for ; Wed, 18 Jan 2023 02:36:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1401B6B0071; Tue, 17 Jan 2023 21:36:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EFA66B0072; Tue, 17 Jan 2023 21:36:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F20AC6B0074; Tue, 17 Jan 2023 21:36:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E27EC6B0071 for ; Tue, 17 Jan 2023 21:36:30 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B502216062D for ; Wed, 18 Jan 2023 02:36:30 +0000 (UTC) X-FDA: 80366356140.13.1380C5A Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) by imf01.hostedemail.com (Postfix) with ESMTP id 2D8044000F for ; Wed, 18 Jan 2023 02:36:27 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674009389; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=QEI2zSdw5lz0Ab0PAkdQu2TFJ9JhmDIuFmeRmcyFoBI=; b=HBTwobMZRWfC7/GrJOdX/BlXyQLvVZkariwBXi+/cArL1QTrEPlNGWxKqsFLyC4KThE3v6 0Uoh4cEcB//t3gujCZCvO+fk2g5xhnaoMZIEXK1cqzIj5vIAkWQ2N3qHx3/P5FksSrt1eT /fbKjCvfQKwWk3dzhojKiiifttajIFg= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674009389; a=rsa-sha256; cv=none; b=zP2t3gcMwGjt6xsrjizLSc5W88xmsiHRmCrU5SvciSzbF4KM5DIR1pTq8Lv0813KyOVs5L YRmiiUyHXFRKT89CYwkM9SNtn5fgHGO36FE0v5XniZQOPLymU+89VUi4P7PK59ndlBRUWm kAQY7c6XuR5DtTLnOD9xB+5cGq7PEG8= Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTP id 30I2Zkjp001017; Wed, 18 Jan 2023 10:35:46 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from bj03382pcu.spreadtrum.com (10.0.74.65) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 18 Jan 2023 10:35:42 +0800 From: "zhaoyang.huang" To: Andrew Morton , Catalin Marinas , Vlastimil Babka , "Nathan Chancellor" , Peter Zijlstra , Zhaoyang Huang , , , , Mirsad Todorovac Subject: [PATCH] mm: move KMEMLEAK's Kconfig items from lib to mm Date: Wed, 18 Jan 2023 10:35:27 +0800 Message-ID: <1674009327-23493-1-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.0.74.65] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 30I2Zkjp001017 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2D8044000F X-Stat-Signature: nqhngyjz1jmkbwr6ndhcjb66biapxdyh X-HE-Tag: 1674009387-192884 X-HE-Meta: U2FsdGVkX1/rdfVZZfZo/0Ya0sOm6DjLcfPyqeCwLOQoM1hQKkIPWuUbJwAFcwg7KQJy/x2c9b0A53IN+yMpihZ1Hm+3QWWKQOvvT9kv3DrTu4dLBONS+nWFwcZUNvNNJxtgY85cOgTabTElvyHKlILQMWvq9HhhmLevTPOn9mu8nW7vT9zQ2X+vDFZZc6pjbHqKYGwj+UeSX+mkmkgMGaE3RG6s1QHm4q/sI0wras0IIo5PamIfsNAK1B2N3M2GKB3Ibo68OXOPiJ43w+UPzIBBgrcyjtDi8IsHNq+4mMinL1LMrgHAmYtgq4ILaQHDeMa46rrX2Y7VOogLfD1uHmVXqJPsDdKQUrqsT7GFKOv6fCi7BPc7iAXKimQ77g59SdhvDJLpUf2Kwj/mTEJWuFWwOBoyIugrhgq1n28tCCRjNr40uXfNOtdJG7aWJAKW2wQxyJ7ZNNUsvG/tj3Iaq9XwoP+5igZ6gHyaqR+HjV1wPECWmEV+//Mux4vOjbZPxQkB9P42B4h2ZsOhHRP39cB5wMWGCsG/E1H5Jn3Pu7ScVCMA+hpjB7wkJkI2UvOdMHfQrrutlzHxH7TcatuoarTDVVfRZ5BT+hlmvYs1w4FI/4b9YAVgefFoW15PD5jae5HxVOacKPeebOShN7ooH6IChmGoSRZRQWjCHPeW5Ly+6ZG8YDmYg4W8KkOxNY+s0gFKF6Ucs86Rbj4dhnVNo2t965i7TS/LjyRSjB0wp3pZLRS5y10oK9ChksScdSTtqbfn9kk6nneMmKLJEVpXioeQWPfhb1rfqB3hY8jQaZOlClZlPWrI3+ONG7I3R2ge1VXRJtWECxZfdQYtrIfjCE+IyjqGRmtrKH1KR3e9N46ph0+LLvfLswCVniOtslaVqy5ugp/M6ZHnmY+dBQpb1DnP0a3R3yC+gzg3w2GOKG3Zu+LzIJBtvqWvFco3Z6Tx X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Zhaoyang Huang Have the kmemleak's source code and Kconfig items be in the same directory. Signed-off-by: Zhaoyang Huang Acked-by: Catalin Marinas Acked-by: Mike Rapoport (IBM) --- lib/Kconfig.debug | 70 ------------------------------------------------------- mm/Kconfig.debug | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 401ad4b..62884ac 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -716,76 +716,6 @@ config SHRINKER_DEBUG visibility into the kernel memory shrinkers subsystem. Disable it to avoid an extra memory footprint. -config HAVE_DEBUG_KMEMLEAK - bool - -config DEBUG_KMEMLEAK - bool "Kernel memory leak detector" - depends on DEBUG_KERNEL && HAVE_DEBUG_KMEMLEAK - select DEBUG_FS - select STACKTRACE if STACKTRACE_SUPPORT - select KALLSYMS - select CRC32 - select STACKDEPOT - help - Say Y here if you want to enable the memory leak - detector. The memory allocation/freeing is traced in a way - similar to the Boehm's conservative garbage collector, the - difference being that the orphan objects are not freed but - only shown in /sys/kernel/debug/kmemleak. Enabling this - feature will introduce an overhead to memory - allocations. See Documentation/dev-tools/kmemleak.rst for more - details. - - Enabling DEBUG_SLAB or SLUB_DEBUG may increase the chances - of finding leaks due to the slab objects poisoning. - - In order to access the kmemleak file, debugfs needs to be - mounted (usually at /sys/kernel/debug). - -config DEBUG_KMEMLEAK_MEM_POOL_SIZE - int "Kmemleak memory pool size" - depends on DEBUG_KMEMLEAK - range 200 1000000 - default 16000 - help - Kmemleak must track all the memory allocations to avoid - reporting false positives. Since memory may be allocated or - freed before kmemleak is fully initialised, use a static pool - of metadata objects to track such callbacks. After kmemleak is - 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 - help - Say Y here to disable kmemleak by default. It can then be enabled - on the command line via kmemleak=on. - -config DEBUG_KMEMLEAK_AUTO_SCAN - bool "Enable kmemleak auto scan thread on boot up" - default y - depends on DEBUG_KMEMLEAK - help - Depending on the cpu, kmemleak scan may be cpu intensive and can - stall user tasks at times. This option enables/disables automatic - kmemleak scan at boot up. - - Say N here to disable kmemleak auto scan thread to stop automatic - scanning. Disabling this option disables automatic reporting of - memory leaks. - - If unsure, say Y. - config DEBUG_STACK_USAGE bool "Stack utilization instrumentation" depends on DEBUG_KERNEL && !IA64 diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index ce8dded..d1893ac 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -207,3 +207,73 @@ config PTDUMP_DEBUGFS kernel. If in doubt, say N. + +config HAVE_DEBUG_KMEMLEAK + bool + +config DEBUG_KMEMLEAK + bool "Kernel memory leak detector" + depends on DEBUG_KERNEL && HAVE_DEBUG_KMEMLEAK + select DEBUG_FS + select STACKTRACE if STACKTRACE_SUPPORT + select KALLSYMS + select CRC32 + select STACKDEPOT + help + Say Y here if you want to enable the memory leak + detector. The memory allocation/freeing is traced in a way + similar to the Boehm's conservative garbage collector, the + difference being that the orphan objects are not freed but + only shown in /sys/kernel/debug/kmemleak. Enabling this + feature will introduce an overhead to memory + allocations. See Documentation/dev-tools/kmemleak.rst for more + details. + + Enabling DEBUG_SLAB or SLUB_DEBUG may increase the chances + of finding leaks due to the slab objects poisoning. + + In order to access the kmemleak file, debugfs needs to be + mounted (usually at /sys/kernel/debug). + +config DEBUG_KMEMLEAK_MEM_POOL_SIZE + int "Kmemleak memory pool size" + depends on DEBUG_KMEMLEAK + range 200 1000000 + default 16000 + help + Kmemleak must track all the memory allocations to avoid + reporting false positives. Since memory may be allocated or + freed before kmemleak is fully initialised, use a static pool + of metadata objects to track such callbacks. After kmemleak is + 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 + help + Say Y here to disable kmemleak by default. It can then be enabled + on the command line via kmemleak=on. + +config DEBUG_KMEMLEAK_AUTO_SCAN + bool "Enable kmemleak auto scan thread on boot up" + default y + depends on DEBUG_KMEMLEAK + help + Depending on the cpu, kmemleak scan may be cpu intensive and can + stall user tasks at times. This option enables/disables automatic + kmemleak scan at boot up. + + Say N here to disable kmemleak auto scan thread to stop automatic + scanning. Disabling this option disables automatic reporting of + memory leaks. + + If unsure, say Y.