From patchwork Thu Jan 19 01:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13107250 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 4E62DC678D4 for ; Thu, 19 Jan 2023 01:23:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60E5C6B0073; Wed, 18 Jan 2023 20:23:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5967A6B0074; Wed, 18 Jan 2023 20:23:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45DEA6B0075; Wed, 18 Jan 2023 20:23:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 35C376B0073 for ; Wed, 18 Jan 2023 20:23:35 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0C7E81C62D7 for ; Thu, 19 Jan 2023 01:23:35 +0000 (UTC) X-FDA: 80369801190.24.32B2A4B Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf12.hostedemail.com (Postfix) with ESMTP id A682D4000B for ; Thu, 19 Jan 2023 01:23:32 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674091413; 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=XW15ZBurfR1Q1q7wXR4Om1l7GfB70bKNKLj336G+MfwZq6Ie5b0KOH0slNl9dITgX3usTh NjJW0Rl/q5pXxBOermn0yuKSlFg4HU6PBHZEoxRgRQ7T73hTybYpwivGYgWI0UXIra8Ljk xGRKWtmN1jgSxVMHIHTZUCF8g3L4WnI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674091413; a=rsa-sha256; cv=none; b=QjPtE97InSAqLiFTjecE0SPfE+MmusCh40HSEXODgmtAKqGjwt416/QUsMR5RoYKvOXjlD a8lvYIB9+wo3yNgO3MkFMdVjcfCGlToxrlF4O7Ml8VYKrz4WGRKIh4u6BzL41oF+82wQuA NNM2t8FsFDm2D66i7EKBOIwhFnHwRrs= Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTP id 30J1MpPB093127; Thu, 19 Jan 2023 09:22:51 +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; Thu, 19 Jan 2023 09:22:49 +0800 From: "zhaoyang.huang" To: Andrew Morton , Catalin Marinas , Vlastimil Babka , "Nathan Chancellor" , Peter Zijlstra , Zhaoyang Huang , , , , Mirsad Todorovac Subject: [PATCHv4 1/2] mm: move KMEMLEAK's Kconfig items from lib to mm Date: Thu, 19 Jan 2023 09:22:24 +0800 Message-ID: <1674091345-14799-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: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 30J1MpPB093127 X-Stat-Signature: 5b9hipg4pntr1xag1qdm3tsxsyot7sry X-Rspam-User: X-Rspamd-Queue-Id: A682D4000B X-Rspamd-Server: rspam06 X-HE-Tag: 1674091412-4921 X-HE-Meta: U2FsdGVkX19Or7p0N80RwqM9yvMUk9wbrLBEQxU4FywWFkSBpRYSWs3kahiKqgWYBehsMdsXsCTnEiuSd28U2iQYpBrUduJfXEee6Iic1JsMnvF28bEB6IlGY+7HsvqACxAdL43eRQ/X2V4mayVCpHjdElm1JoO/hs0fYyiI2PiHa2vHDGWdwAohEYtDBEpv1Mq8zfYknqhL2kq//cqW1vD8ycyzNiGHyUXzxG3vKIOk1HmEEqn+yWn2PPgKP/PNkS4NIM18ZsHyAfGoiX3h5A10Jf+cRiFQoQYC7VGtqEg1JAzt34EGB3//ZYgrB2bsJcBmK2wV2l3p+uTcioH9eWEWKbgeGD0NhTrnlHrKr6Hti4loXtSMOler73vYKr6W5lCbMiUxqpmHgEqHkN77RJKO8Z60tUWsL+2sv0Z9EAppUk9h1y2QuJjU/4/Ygcux1xS5xcVE84nWsV9umt9MEc6nAvW3U7U6LJ4Gl6TC8P90bUX/RCOfLRQNJcblQ17nNf5Z3ZnS6ElARhNKbNJIa8QstlSpC/YDs8AGKwtqOCeOFq5BDcmL5Gu9MgaJIWAPQY41RbvXYAJGwgfm6M7C4Rm81KEXfkuPeeGHqiEvX9skXvWrZO1ZOo98SmuSHfdB8QLToaMHg34VLjbrhR3M8Nm/ZVk14NCOIO1/n5nejXUf+1Zm7TtJ6PdN42o7T0fvcu+m24dZ5niJFzM9Tmxx9acXpDdKRmUKQjU8tdIuBnJQz7L4JelFj7SE2f5BfpZh5D7al1HQOWwlnxeVaIIqWiAkKG50qAXLGvzAz3Eab1xe3b1p9Kz4tu1wkgDlVjAxoVjYZT3s5lzczAYQ7YbgIN6yEYBzw5LxduAD9cXkSFIMgWnEmhstFXHSK3V7RFnQzS+YIcIuDr2yqNCrbpJfyruQ/XMj0TA9F/cpVX9pJ2nFNbH+YgU38sEkqVJsSx4EPg/Wz+mgdQlOyFXJJqb fB4myuPO 6xwxcE5J3RmYF70c= 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: Mike Rapoport (IBM) Acked-by: Vlastimil Babka --- 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. From patchwork Thu Jan 19 01:22:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13107249 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 7426DC38159 for ; Thu, 19 Jan 2023 01:23:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEB336B0072; Wed, 18 Jan 2023 20:23:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C9B1B6B0073; Wed, 18 Jan 2023 20:23:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B62716B0074; Wed, 18 Jan 2023 20:23:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A43976B0072 for ; Wed, 18 Jan 2023 20:23:34 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 80DE41C623A for ; Thu, 19 Jan 2023 01:23:34 +0000 (UTC) X-FDA: 80369801148.25.B98F38B Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) by imf15.hostedemail.com (Postfix) with ESMTP id C5C49A0011 for ; Thu, 19 Jan 2023 01:23:31 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf15.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=1674091413; 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:in-reply-to:references:references; bh=jorMgqEQTOzxVCmiX8ybMmNHTugBay0HmFWGSRVJFk8=; b=VFDB5nJBd6SVbWxiOUEkUg+k9gUIFQ7BkC/1uRfyklra4aKS7t8EPdiVICG8BZkJgFmDFN VAh25eaFnUFU8BcMfDvEjcCsrYdRRd9Y3vvPJ1HwoVPf4OEWNS55MfyQxZlLswsHnD7yJa Nw+yyJYvlo3PGd1OxxzkfkOg+g0iwDU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf15.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=1674091413; a=rsa-sha256; cv=none; b=6O7AekGtmMj6v8YIlYhuN02ZSnsuGrrV6I9i9OPJURG2DCr0rwvWJhx50yDBoU8QZGZgtf 0vMRbBX7QYmU2Nbb8xxVttdlH0OQqIFsT/W4goGmPfyBzOOZcuIR97Q9iMKlgLp1NDXJmp bkQR1UcZpqccx4ErMPkRVFwOkXKhSjU= Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTP id 30J1Mu1A093179; Thu, 19 Jan 2023 09:22:56 +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; Thu, 19 Jan 2023 09:22:54 +0800 From: "zhaoyang.huang" To: Andrew Morton , Catalin Marinas , Vlastimil Babka , "Nathan Chancellor" , Peter Zijlstra , Zhaoyang Huang , , , , Mirsad Todorovac Subject: [PATCHv4 2/2] mm: use stack_depot_early_init for kmemleak Date: Thu, 19 Jan 2023 09:22:25 +0800 Message-ID: <1674091345-14799-2-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1674091345-14799-1-git-send-email-zhaoyang.huang@unisoc.com> References: <1674091345-14799-1-git-send-email-zhaoyang.huang@unisoc.com> MIME-Version: 1.0 X-Originating-IP: [10.0.74.65] X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 30J1Mu1A093179 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C5C49A0011 X-Stat-Signature: hfew44afqscgaygjn5yepy9jodi6yid6 X-HE-Tag: 1674091411-65744 X-HE-Meta: U2FsdGVkX19OB3/79s+5ysYBqbT/HVdJsWhm7+8fMb1WJIRfixbBtvbDlmJUFxonH9ryWUz3uu1eIrRmueEUgG3eL+UTY5NscxC757mMxLtOljsndF0rsA72Bz0IK4COZ28753ommEFs6fem67Lh/hVjWkyDJC6XECwh0orRyB4UGn3iKj0pug3kF2NHwdcaRwwHtycp4lpooFDle0SKB37OJDt4/B8f0wX+aNEdREezyPtLk1m5+GzE5JaL9FboSvIFTSO7E2XRhAuzX9OAu4qxNu8IAId6SEc8l0ulKDc2ljnw82Ij1cLLhhplL9om+Oa7zDyBBX1yxLORV9pSztJgkpW0Iyi7Qo5w2wfwwj2FY5QIOPWi2SkHlVeToDgamQAUHpy37Z5o8xZFoeMnyJac0frg49WKK3ALZxqS3sX6ND0sGjlrdiu+2aHZCcCePWQcwM5tvV3wppzkaNmcXVw8O8agbHU1tVxLsb1sHqFF3jki1LofeIeF14Xn1CIhpUIlxubRpxyNjxnO1gdA82EM+5Me2ktSRQtBLWWI0DJC+hg7Q+JFXofb01i+cMoTQPv/0l+13naGSSEelD24pFFAgOGd8i7MhgevxO66puAgxbqrbOLGzFo9m/1IBZABHVQX5em0+V78PENKI6GsO2Wfg45D+2uRfJ4CKlJ+RfUVgeJ1w2nmTetUjzSPexKtS/YWu6W0ts7vnJtlsx2DCLow1rifk4MnQOZZBCzMyNGvlYC+4hPYvmh//Vc8A/A/PBYrx3tvBugTHhynfL8yWonEI62v7TpBg+Ji+BIhSH/+A5QgRQ2NrJ0+sAoq2zYMq9m3B5QrvETk9urzpCDgWR23X5KPnCmBwuw2Kcf6t971Ll/9XOCHC7uI1jfeP6lfXP1GQhWt4YVM/O11+WZK4E9CIjSD7l/4Cnynp1wMhXPUF4UENxoQ+I6aKFes1Xo44rgOkIBCLprUJ5tI/85 IJqTlUz1 oM0np3F0nv1OykJA= 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 Mirsad report bellow error which caused by stack_depot_init failed in kvcalloc. Solve this by having stackdepot use stack_depot_early_init. On 1/4/23 17:08, Mirsad Goran Todorovac wrote: I hate to bring bad news again, but there seems to be a problem with the output of /sys/kernel/debug/kmemleak: [root@pc-mtodorov ~]# cat /sys/kernel/debug/kmemleak unreferenced object 0xffff951c118568b0 (size 16): comm "kworker/u12:2", pid 56, jiffies 4294893952 (age 4356.548s) hex dump (first 16 bytes): 6d 65 6d 73 74 69 63 6b 30 00 00 00 00 00 00 00 memstick0....... backtrace: [root@pc-mtodorov ~]# Apparently, backtrace of called functions on the stack is no longer printed with the list of memory leaks. This appeared on Lenovo desktop 10TX000VCR, with AlmaLinux 8.7 and BIOS version M22KT49A (11/10/2022) and 6.2-rc1 and 6.2-rc2 builds. This worked on 6.1 with the same CONFIG_KMEMLEAK=y and MGLRU enabled on a vanilla mainstream kernel from Mr. Torvalds' tree. I don't know if this is deliberate feature for some reason or a bug. Please find attached the config, lshw and kmemleak output. reported-by: Mirsad Todorovac suggested-by: Vlastimil Babka Signed-off-by: Zhaoyang Huang Acked-by: Mike Rapoport (IBM) Acked-by: Catalin Marinas Acked-by: Vlastimil Babka --- v2: use stack_depot_want_early_init instead of CONFIG_STACKDEPOT_ALWAYS_INIT v3: have the Kconfig changes commited in another patch v4: select CONFIG_STACKDEPOT_ALWAYS_INIT when DEBUG_KMEMLEAK_DEFAULT_OFF is off --- Signed-off-by: Zhaoyang Huang --- mm/Kconfig.debug | 1 + mm/kmemleak.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index d1893ac..466a37e 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -219,6 +219,7 @@ config DEBUG_KMEMLEAK select KALLSYMS select CRC32 select STACKDEPOT + select STACKDEPOT_ALWAYS_INIT if !DEBUG_KMEMLEAK_DEFAULT_OFF help Say Y here if you want to enable the memory leak detector. The memory allocation/freeing is traced in a way diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 762b91f..ddc1ddf 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -2070,8 +2070,10 @@ static int __init kmemleak_boot_config(char *str) return -EINVAL; if (strcmp(str, "off") == 0) kmemleak_disable(); - else if (strcmp(str, "on") == 0) + else if (strcmp(str, "on") == 0) { kmemleak_skip_disable = 1; + stack_depot_want_early_init(); + } else return -EINVAL; return 0;