From patchwork Thu Jul 25 04:12:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tikhomirov X-Patchwork-Id: 13741551 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 3CC12C3DA5D for ; Thu, 25 Jul 2024 04:12:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 900F96B0082; Thu, 25 Jul 2024 00:12:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B0566B0083; Thu, 25 Jul 2024 00:12:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74FF46B0085; Thu, 25 Jul 2024 00:12:57 -0400 (EDT) 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 582216B0082 for ; Thu, 25 Jul 2024 00:12:57 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D8DC81A0D8A for ; Thu, 25 Jul 2024 04:12:56 +0000 (UTC) X-FDA: 82376954352.08.D1EE9DB Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2093.outbound.protection.outlook.com [40.107.103.93]) by imf13.hostedemail.com (Postfix) with ESMTP id 162D120011 for ; Thu, 25 Jul 2024 04:12:53 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=selector2 header.b="V4ULh/ho"; dmarc=pass (policy=quarantine) header.from=virtuozzo.com; spf=pass (imf13.hostedemail.com: domain of ptikhomirov@virtuozzo.com designates 40.107.103.93 as permitted sender) smtp.mailfrom=ptikhomirov@virtuozzo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721880720; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=yRODul/gSalLQ3/wW/OJKz9CCCurFC9o0jhqDChdRNc=; b=GTgGFW7zEGDi1Lj+EPnYrnlNR9gBTBhkuGXArohOSXttLaY0K+WMo/9HRYoW/VmREPTzgq er8198DdHMd3bdfoEwjnJcT003kyiJMI25nIk+OiysQUo1qYjdPsbryoMe6EZgGinI8HXK UcQEcpcRfgHQkhel9In/vFzftubgOgU= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1721880720; a=rsa-sha256; cv=pass; b=bh2MuQGhzIn/Oi7z/uWu3NKFIm7SqL2NlWdicnHrNbCILCeqWI7q1m0QSevK8mqnSQpyXQ x+WA6DCT2H1T0ojXzfLGk4b5MSdbFcpqFx9bnbuR6kbFrTdn+/wQH3E09H0xDzXvu5/Gna PInbt58CWXPSHlnBPEj58rD0ow5pGj0= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=selector2 header.b="V4ULh/ho"; dmarc=pass (policy=quarantine) header.from=virtuozzo.com; spf=pass (imf13.hostedemail.com: domain of ptikhomirov@virtuozzo.com designates 40.107.103.93 as permitted sender) smtp.mailfrom=ptikhomirov@virtuozzo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kHDjKxgBSTw5rIil1Ceu+q/+T70/uOqEJ/rOU6VsXMg34xonmMo5tfUUzAHdrcbiMhFWYN4l3kKvhoab2P43+U3v67BVeR56PheoV4Meh8mESQx8ywm/FDxONYJKzAy847ixod/GaEvzPjHA8IgOp3EkBf8faVhD7o6hVe6dpoVf1wWOveCSNnA9aPmhKw6uTAVfkAGBnAla13O/KKnEyaJo/gTYM/h1bIIEhu5gYeQ/vLBJU4VcqtD4jC7Vfg4/1zhrwaAACEIZnmhiXh26KaYZBE1+XgRS68uS0gpMH3IT3sLiD+Xl01HoIGPNobwZueXPZq8INWzv5malpmDyAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yRODul/gSalLQ3/wW/OJKz9CCCurFC9o0jhqDChdRNc=; b=qghyS3QqegvC4qP+0oBnO8vNz0S3Rg3/QmKzgLsss/oaLvaANGxTxv+GJXO18SSKeGHk4mKa/7TXt28CZ7BskPy3xEM/PfSdRSLNmz2WJoQJCrkRbE9tQQxqcL+Q5FlJl5PeXXP2lyk8BvmMlZn/WCXDlAp1uEqG7ZleDSl3E20dtwBZfDUSoDt8Zb7FkX+gR5/YhIiNAlD98SiP7KMRT+p7m33HnSGncDN14W/Zbxu+9/KnUSzh+n5di+fWIQ0AGR3kw3h2IvyVOJmD81SXDVGPkm0T8a41aXtnjavUorjlsmxPD5KLz/8i487QQ7l0Z4tYHxeJvkpBRMbX+PlfEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yRODul/gSalLQ3/wW/OJKz9CCCurFC9o0jhqDChdRNc=; b=V4ULh/hooyNySEpf8iu5LmZtBYtlspYljMRIGCqiuuOXQWnVViyGgt0omz4MEuucgp0S8eoxnSz9ZcQeRrne69MKukxZK2TWCnt118HgA1XockzJrP1Ib2M+3RcZtydlZ0Qyhb6fBK2AJV0J1Pw1QFW3+2deHSawP3EdfoIzBpy6d3A+I/saCj7cryY7CMBla6/KL0wGNucIDr7wGcihjs/QO0/4/rhNHEgmVMt3jTLUboJFOs3KN3hU+lHTm0r9Lhz7UJ9kBvZ6PWVNIVfl6+d1IbGcik+SwIH2lqn9/vLEyFeks5DXDnr9SULzppok/NFiDaNKMvMRRjGzHerOEQ== Received: from DU0PR08MB9003.eurprd08.prod.outlook.com (2603:10a6:10:471::13) by DU0PR08MB8788.eurprd08.prod.outlook.com (2603:10a6:10:477::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Thu, 25 Jul 2024 04:12:50 +0000 Received: from DU0PR08MB9003.eurprd08.prod.outlook.com ([fe80::7261:fca8:8c2e:29ce]) by DU0PR08MB9003.eurprd08.prod.outlook.com ([fe80::7261:fca8:8c2e:29ce%5]) with mapi id 15.20.7762.027; Thu, 25 Jul 2024 04:12:50 +0000 From: Pavel Tikhomirov To: Catalin Marinas , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yongjun , Chen Jun , Aleksandr Mikhalitsyn , Pavel Tikhomirov , kernel@openvz.org Subject: [PATCH 0/2] kmemleak: support for percpu memory leak detect Date: Thu, 25 Jul 2024 12:12:14 +0800 Message-ID: <20240725041223.872472-1-ptikhomirov@virtuozzo.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: KL1PR0401CA0003.apcprd04.prod.outlook.com (2603:1096:820:f::8) To DU0PR08MB9003.eurprd08.prod.outlook.com (2603:10a6:10:471::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9003:EE_|DU0PR08MB8788:EE_ X-MS-Office365-Filtering-Correlation-Id: 75b14c78-ec08-4e08-b715-08dcac600be3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024; X-Microsoft-Antispam-Message-Info: bECMjHTANI6D3AXEwki+JqvDF4vwhePn0HTDAqM8czGABgHATkxtk6+JXQ8jo8pYdlQJnVKKNBmJCP+89PiXs/Tf38JEBHQziNd3YgrhLEiRw0MZ3oWFLVOP/2vserIutgdsInD+s5ti6NW+wvPuLVJAlUQzuDNO4Mv4w3m7xa+RWZwM9G1DvjYIWJ0PXC4SNH3S0eqKoIzPORJQTbkfWEvWPdLHujpeysZndQYLFuKJdQCQJU6ajyHzpX2Fh4bxTmgM2D1z/n3wboaDY2wD4y6U0NZuQKqFBT9kmuc3/EOnTn9JVQevrHZm2p5uaE7FziRUGaKyyu99OOvlStHmxAhkfuznNiYZbtla8eGP7nAk9xMhBrXWdKOk99sHEYzzFdXIi39Xe8xcr0Mt7W96ZLQPGfRrUGGEiyxA0zLKl3EAM3KdeVpHzPwDdb9F+7b4WuimnO2VxqE4Q8zocjcL4WFrb7dZ3OFwIhAUJIe5zdUOnMy38TFQ4cKo0gnqipbxR6rr+VjVszO1cC0f5bqm5ImwWSFlgZu0ZgpaumLe2uGYr9tnbSLvs3nAFfIO2eLQCaS4ncnJzjkICtwFEH6f9kU7k7egqHDTFrCNlYrf+K4utynk1M1nWXQfgigsBKZMoJtO3Yn1nur2Ix863uGsPgfxWaEymxfWAhApUpXIEIhp0eE0ZN1m7pRfQ+JyE9Dl9D8wNBr+BHMyAUKN4zUs23Q8SppJ54WVkH0UTA+fKHQgf12oid1uqmn6Kndl+q2Qh6h11saOmQNYw+4Va6iv9Hj+opm1uj/bwqy+danloderOV9wJF6B9KES+/+Nz7BhuvxelNrabZfilrw6V8XkfeOnqO9BYv3CCIjytrSsxVKOPAMaCWwEmNAVFRQxL84b9wUipdXfW6kuxOFQEufo1t/JEV7KuR1PuT4YNuO5qUBREqmtBpzr3HkxAPRuygxPCVb1Rnmbopkz/DWojGVogsEqsE5gJ//o4YF+ptqTmNfehnNsVFEtLxP4ROrqAAc4lxyVICbL8e00sYtGAF8Z3PtWEaTxm2HJQRxEF+E36retXc25IdZdSyy0pgFaxmxKOnE+SrWtu8nIB4TGjEiYBZO4WSJNgs+2YH6CSTWJN0y9ZPVUSGyaZlYeBzD6ViU6/FBnR0z7DYOZUL/EZ1UQStlR80CUrFS576AxtkSlM6MyBrzapHW9ScfjVjYYrh5+jWW13WYzDGyrWteN1YFF+WAdHk1ZaSqVeGPVgncKhoAehWA8+l3fRQXS3/7t6tLAtlXQ/wJh7Av7pzGc0whL68rdoQhawwPxL+ppcTNNiRo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9003.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(366016)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pZoGs2r4z4UeXiQ797oGPAJH9H3uS7D4qB9Z+DH5UULbJM6lm7Yux4YqETko4UwYpztOr9T/ulp7Id0k9fyMTtCokdYjlL+FISZVArjFAb5AcrlHZpDiko4gO7jS/jYYr0raarcsxR3XcuP3Pc09SRO8Qf+jombzYNxaaGIZVCc/a8yFke/zMKAgSPybHEkdk2cfCHEbP98EWaBdg5ftiIjZTgesREsmFLceBiYS8LnDk6VvAVt6//3sTg4OjZyiZjNh6ZqCj3BENdeJJy6OFGUKuvvHs46xbVeFxsOGY2NY2Mk4tjUrJ7lqsGfVk/s5nghuces9QLMmtPNruq16kNSej+T0LCbB1wEOehSihO8n/w2RfWmXIRkSEYHbTq/EckJJu49laFoTEGYyTtYxxY2wQhwjJ8U4+gRgZc416ykKKp1QAGqU4zSzQMZTe1XZcRk8PtmIxfNb0LnawUfXosLrcrIFf2KwOHkKylnCQcxJUvhx78wyH1Xy+e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nHJWku8CgOZFfXNnB3z1lwBqU/xVVriuqTBM42ZJFetEQ6QoDBYyNkqP6Rv+VnzCvvROcsuadEBcm03qahW96Nbn4r30bF4G/V9mvyMC1KmHA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75b14c78-ec08-4e08-b715-08dcac600be3 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9003.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2024 04:12:49.9328 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PFV+NScWCIqI5iRBeaxi7uzfo6G2OhCkZvA8NUHUy2QGrA2vPPNjLc4C0hbRL4Ucv3juwNO6iMTOcowqzRCwcQIDU/NG+hgjkESdBtH1YlU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8788 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 162D120011 X-Stat-Signature: skja8qhd3knpwrxkbxb8gr1uqsoonrb6 X-Rspam-User: X-HE-Tag: 1721880773-953958 X-HE-Meta: U2FsdGVkX199dG9P5I8KlvgGgNO6v50LP8wEjmiQ42IrLAr2FuxJnm5exqVsIrKAvDGUEnhVQcq+AKrty390WT7zr9oFKvi5NLShnh8fCg8HAPtgXCsW13OxFslo2fxoV72krnNIigbu2Q2GbYqxg4hI/Mr6XlvqpaM5qSgxx4OXuNaQ+nvUOuE9TFDiBdsDc4KW1VndeHJW+r4ulbiKLvtXbjEtLTqGVqhmeOeNd21TDGM1b2WsQUoO43nvrBGs+buLVlWo+eCrOBlHYd4I8JThr4977s9tlhkGPzqPs8Ih8Xrf1/ntub4ON2yLYRYeLRMM9JXNr5XEyUxq6UAsOlhMaW37k3yGn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-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a rework of this series: https://lore.kernel.org/lkml/20200921020007.35803-1-chenjun102@huawei.com/ Originally I was investigating a percpu leak on our customer nodes and having this functionality was a huge help, which lead to this fix [1]. So probably it's a good idea to have it in mainstream too, especially as after [2] it became much easier to implement (we already have a separate tree for percpu pointers). commit 0af8c09c89681 ("netfilter: x_tables: fix percpu counter block leak on error path when creating new netns") [1] commit 39042079a0c24 ("kmemleak: avoid RCU stalls when freeing metadata for per-CPU pointers") [2] Pavel Tikhomirov (2): kmemleak: enable tracking for percpu pointers kmemleak-test: add percpu leak mm/kmemleak.c | 153 +++++++++++++++++++------------ samples/kmemleak/kmemleak-test.c | 2 + 2 files changed, 96 insertions(+), 59 deletions(-)