From patchwork Tue Jan 17 05:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13104181 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 879CFC63797 for ; Tue, 17 Jan 2023 06:00:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F41746B0078; Tue, 17 Jan 2023 01:00:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EF1696B007B; Tue, 17 Jan 2023 01:00:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E07786B007D; Tue, 17 Jan 2023 01:00:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CD2B56B0078 for ; Tue, 17 Jan 2023 01:00:53 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 91DB240139 for ; Tue, 17 Jan 2023 06:00:53 +0000 (UTC) X-FDA: 80363242386.09.B8E7167 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf04.hostedemail.com (Postfix) with ESMTP id 7343140021 for ; Tue, 17 Jan 2023 06:00:50 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.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=1673935251; 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=sisJg9XG2PU7BopEVruC5/ToBIvXI3DVE/yo4Q65jH0=; b=YvjISvQJTgBrXOVMjjaHjphSw8sWJ0k3bLUxDTFTLw48FM+GfMn4ZmTsYBxaVqMjtFo1aK T1kO/D+cymSeLddo3bUU13jd37IFkj5t2yN6bzmcAgdphoSE7Ha3Y2bfPbDJlliNoC6jLY Ujyep2xoPgyLvfbG8QuI6LQVP/lP444= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf04.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=1673935251; a=rsa-sha256; cv=none; b=meUrQXEeCHxSvuWohkMpbb6bpqjz9zlm/cYStTLDPIEBOEGUdsP1IxRWujAuSQuvT0180r iBuHfoqY6VOey8TdYFsfQDFL3/BQPDRCRAqPnSaWsCD5kMyr22VhgHuVTZ6/T4QnGHjtUV s7dM9LdwL79xPwlgpzdyJKIhWbKvp74= Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTP id 30H5xluX010533; Tue, 17 Jan 2023 13:59:47 +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; Tue, 17 Jan 2023 13:59:44 +0800 From: "zhaoyang.huang" To: Andrew Morton , Catalin Marinas , Vlastimil Babka , "Nathan Chancellor" , Peter Zijlstra , Zhaoyang Huang , , , , Mirsad Todorovac Subject: [PATCH] mm: use stack_depot_early_init for kmemleak Date: Tue, 17 Jan 2023 13:59:29 +0800 Message-ID: <1673935169-30019-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 30H5xluX010533 X-Rspamd-Queue-Id: 7343140021 X-Stat-Signature: rj8dpsiktgewo7317kpnf41x6pua8ikc X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1673935250-40257 X-HE-Meta: U2FsdGVkX18m3oAmgDSQnszJe4d0TP5f+2Ve3jZg3lTMx+VLTmpEt9TN85zWew8DTqZwDB2K6p5gSwYWX1dCXcSAVFEzM8W8Yx5OD5+ZEBHWgQumWjuu7okud/S8rfLzwM4CspWF8hzhpNaWklEO3rbO8JfBETClhNfMNWYx9iBNKIgCt5EmxQ21igUIdaQoIplviN2uNXbMwgKLOxj4sR5t0Z3jX3FGxdxWy8tceCqKpqTJfSgLcOqBsmKy6Pwa8K8puHkWOTgiaRPtW3y/9Hfq+Z1Omtw3m9jSCz6wsM5njzui5q+ryIpK7DZTfOj9HP4HsAUUZ7gkj5Fq/mQpGQev71fwj5QaUBKn9ogK8X36hWl0XagUhG5YzSdLpXmnEctTUXzqcSf+ch3JBEG2pebd2O8TroJ6JKgQ36glJteG1f4JpJxPlUm/7TRI0dTqUuM0DcnwgxWLKd5c3pRuf+6bTOeYS4OUPchYTtiBj589QmwicFE9pbiNIfFMKA1SOkA93wgCASqXSodua48TgaNAT6yYL4R4qYB+ZUS9zoFoLUruaucDBi4vFogKSkkPNPrSvAZX016s6uHIImDW3udsvTOmURjBBeEbTo4tfsujMYvWc/WNCDNwFXyWPVaWB8JJh2vAT2N/u3r3DHLTeg46Cb9T6ULlZAEzLh9al097k5p6lCxM76FJHVyDM9jv4j8OsnuM2weVAv8moV1BrYFnncL3aAfF63xotzekjCSmsxr9uacshN0wDqEk5JD/5mmjboLUGh1aSCrIzg/a14T2f5JocH2kSOCF4CmUm+LpCuOLDkmbJBybV2eVgsk1weCPi7f9q49o12sQaKr3x6CqvMhGE9gxG6wuTWn25VQZxOccnemUwK+j3XOadLIZTNVTNYLGnzneBXQXg/M61XiOSpvSNHLfCA75lvT+hVRsTVIHb/l2wfxrG8yOf4+nvSIm34isEoGFBA8EYhU 81pSeOB8 DsUhsgfg3beS1ysibjfJAOOa4nZWt60wh6TjaxGWAqgnmHqezmyWmFNCzEM4LI45aGPI5 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 Signed-off-by: Zhaoyang Huang --- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 401ad4b..50cc9f5 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -727,6 +727,7 @@ config DEBUG_KMEMLEAK select KALLSYMS select CRC32 select STACKDEPOT + select STACKDEPOT_ALWAYS_INIT help Say Y here if you want to enable the memory leak detector. The memory allocation/freeing is traced in a way