From patchwork Wed Jul 31 02:54:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tikhomirov X-Patchwork-Id: 13748010 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 7D678C3DA49 for ; Wed, 31 Jul 2024 02:55:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E1EFB6B0082; Tue, 30 Jul 2024 22:55:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCFF36B0083; Tue, 30 Jul 2024 22:55:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C21D26B0085; Tue, 30 Jul 2024 22:55:50 -0400 (EDT) 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 9D7D26B0082 for ; Tue, 30 Jul 2024 22:55:50 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3EE88C01DA for ; Wed, 31 Jul 2024 02:55:50 +0000 (UTC) X-FDA: 82398532860.27.291837F Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2090.outbound.protection.outlook.com [40.107.21.90]) by imf15.hostedemail.com (Postfix) with ESMTP id 7DE0AA0008 for ; Wed, 31 Jul 2024 02:55:47 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=selector2 header.b=Upz+bJUv; spf=pass (imf15.hostedemail.com: domain of ptikhomirov@virtuozzo.com designates 40.107.21.90 as permitted sender) smtp.mailfrom=ptikhomirov@virtuozzo.com; dmarc=pass (policy=quarantine) header.from=virtuozzo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1722394519; a=rsa-sha256; cv=pass; b=QS3UC0gGlYKGEshI5+D3p5uKk1bqa6+u6sfpLXppquvTTBeL6jtp4T3nrwU5KHN/hzVNzj UbnCVaWuRaeI9dqTRWQeOT/9xr1+BcWIG9PQMHqkMpFLwYcrePJ97yRRyyXBQuZyjz6e0t kKWSFzGYMfLfoQoQwC+c5OEQIjEu2i8= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=selector2 header.b=Upz+bJUv; spf=pass (imf15.hostedemail.com: domain of ptikhomirov@virtuozzo.com designates 40.107.21.90 as permitted sender) smtp.mailfrom=ptikhomirov@virtuozzo.com; dmarc=pass (policy=quarantine) header.from=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=1722394519; 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=eFmyXosoi6uRycxHMBoLBCfkz/hVG/tYwxhrjT3dBT7BKzrO7rWyM8C6ysORWnEQN+KzJm WC3mBSvxfXTQHzcgLlsicumgtBw41ReMLaqM6/PWwRgFaZsOC2GhkSAZoRYyTonGBpNRIW ippHXtSoSXoAkEv4/xOakbJ8DFLxA7I= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nKf1zgLVKmNJ6JlGdas6GFAfp5ojpLI5UuRcFAARQGRfyzQg1n9CiF2N4IcQUk8IbjPmrfLhWehH5gRAIZhMabh57TjMSD57csxU5Ii6ocRL1w2FMGYa0NN995hLVQBAI6ILhzljVwd48A/jB5H1fy0RsCqQLcI81V20Ju7UfXE+Iw+WLpZNM1e0r5W8Qyr+XtGOLGJSy13eEzNeIppSfOpX6g4ocREywAvQ30zSPSTGevtmc3oHrjG5OJ/hd2jjcBwWMlhONz7vfVDcjBa7neGThS4SCJwttjlLuoPMzKOJpv9Tcc8ZeUNrO3cQRtbV1nhAUKb3i8dM4vtsGzsmWw== 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=exEX4qBCMD5p89FhzEEbRFmtShA+lse1CNZH6KXjrfEwdUh79HTAdPsJQYHTgbUS5MSKu8WtchgAA5pSxzDsOCZaxUjFVsOPNLCtU/ybLOjibCV+a2s9HkbGgrfQjtEJjJMIfRkK/VrPCzhduGr5w3TIEsTj4YIYapn5pEJYre1f8+f/RP2c/ZVZJhBYYEdA2PjF4Igv+Bw3qJACyIPm5jRBLCJW/EaWOvx8iWes/TnQcZsl+IKwKISLJ4tlRvgPlyyHvfOfOPHOk7Ju+6BOgeY3GoRmCXhccJ05tiHsz906UPcnIXtAvOIJHvkv5Tk7GxXMfDlpwfzh7s6g0MhcnQ== 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=Upz+bJUvtLbcBAKQQzMvcywAyV+nTSSkwgP6frkgKrAfxfiRPazfQjT6Co9HsfvQdfTnUDZiAGiAxSz7Am5lydYcYPttzOtBA3u2xgcydNTNR4nsV25A8F+3jcMIfD5prWtYV8IXY9X9/tNGD8glH0wROQxTcrJMH89orK5/Hv1+D7wMDMrIegX4BbP0y0DOspxlgsaj36HAAEucEnH5/g+nll4ZfasXmSvBlcg48QJdv8xH0QID/hbQh4dV64X+6YNuH8sMX+BaJmP45LuTJfCfquxe8QTL8LmDftuCn2IJclinQfwc8eq51fR/lu89tYTR799R1f20MfVsXIl/cg== Received: from DU0PR08MB9003.eurprd08.prod.outlook.com (2603:10a6:10:471::13) by AM8PR08MB6483.eurprd08.prod.outlook.com (2603:10a6:20b:315::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.21; Wed, 31 Jul 2024 02:55:43 +0000 Received: from DU0PR08MB9003.eurprd08.prod.outlook.com ([fe80::7261:fca8:8c2e:29ce]) by DU0PR08MB9003.eurprd08.prod.outlook.com ([fe80::7261:fca8:8c2e:29ce%4]) with mapi id 15.20.7828.016; Wed, 31 Jul 2024 02:55:43 +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 v2 0/2] kmemleak: support for percpu memory leak detect Date: Wed, 31 Jul 2024 10:54:08 +0800 Message-ID: <20240731025526.157529-1-ptikhomirov@virtuozzo.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To DU0PR08MB9003.eurprd08.prod.outlook.com (2603:10a6:10:471::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9003:EE_|AM8PR08MB6483:EE_ X-MS-Office365-Filtering-Correlation-Id: 411af27c-75dd-411a-c801-08dcb10c4483 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014; X-Microsoft-Antispam-Message-Info: TiS6heEkQWgXCalU+8v8ZgzbBjGr6sqB4+ggoNIOQCxCtRP7m2kpM3QkLi3kS8Ds50G0cOKT/quvBgUxrzfFZEnTq3oNiNgfhOjWKzDb4pd3zMBWFEBqfPO1HAbRItN8Oon/7rla7lrPdiXoUcW43QiOML3G7sZljDuBn9Dhqh+/DTIXelo8Na5awYn4vwJ61XVXsB4EvJU4GcY+9ExVNZzMMHcs0T+NRsBwBBKUpdsiPl6kTy6uZMXonQgCbVaRcL+0zCmUvxMyjfld3uA/+WbuFh3yAom4qCSq04yfRK2pCKRJjpgXf33yGXrY+cOK5GBHNRTZSknGlDjm1f7/xwDsuMNPMPsdr+WM46yaqzZAUkJJjHL3WXatDRrAwhmb6aXJuvR4vYn7DL0hD5OQr26A72VbmE/xRgA1xSJ25YI9IiQs3vXgJD2N/zBHUvl+cYoacTlNEL0h51/xOo8AcTi2t7dSa1smpvmQlK1TUP7deubhtrnHDjzLfIXOKx/xnLdjSu5v+xawOv5PpUkl7/ylWKseblBAcigeBMC2aTP1T4BHtNcc4/Ld7/pfY7+gLjYOvxkPfDM/BcyDrEtnG+d5lCTURYbQc3saDfSpT8WAnqtCZ9z6hSxkeEaDNWy7r1Vdn886Q9GMzuBWNnfPpUPxDRT1/N06426ywMaON8UoU+CK8tanYrFIzdX4n/N+aeChctpTPf/7E3xHFuXkwz4ixPX7hAQBtLiLf4SEktQeseHjgloHNnWjTjHbhfT8+wcU2jHGs7TOJMUCBYxsFi3JW433Oio9s3zxQESFcfnksrWxVgohUR3pPLLPd6erSdk6DJsm4Yayb9uxTvGvCJXLZP+PdTizVUk8C5UUU+A3WcTk5FaZ2JxHxIsd6Sdm3oIadXGInSBHItzns3H7zYq0UYiY0GKxQbClF2NxJcYeNqL30tPiLBqNa3/5RhBleaAe4RPabN/0yLGVnnx28Xg52He88v0Q1tqAnMSufY5b7tjEDLSp4JY4Kuf7e0PcaTZFV2/BQHakVdzM4vwEQOHrVRk+tmt07LrH+tAjZoT9sraIUkumHHGkvoZ/OzKLRLe+G6F38ctQdEukG9914n1sOPwrEnaloSFw+uJM12sCA3a2N7pvPF7uTFbCq2ummCOfRAe62oERh7ca55jQ9RBBxavFL88HpXdbgTnWjfFZsxpBc0a/Dwmr8oGkc97Gh+IOfCVBC/X/QSgMmnVo+6tHZCOUvjwiyizNqxh6a2SdQsVwM3zihWJ2RzpewWfztpTNNdAWRY/xpKA+mK+mGXvAPB7pw3TmN1u5QF4vJ/c= 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)(366016)(1800799024)(376014)(52116014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IFUaLAurR0WzNJcE72vucTFqa/MWtHR2WLYfOEtNbtDrQh6oJLe2E6+bMidItM92mwBH6FUGeNKcpGvWbwr8bo8hcq4AqxeVKRn1TunglAQ3X/D2ONtczJ+tcZeEBH+BbL2ISdQDZb0ngV2j4bMuNC5/dOl8fWKygRa2nb4Nf9rtkAJvdYd75zgGJbsrI2S9GzQ+zsN+xu2lYTn+WH0CHJeMbTNmlw0DcxJDU6HAzo7s66iNDYJQ2Tjg36HWeQkZ1yfBSVpNqUwJsvWVZ2SfXqaFZZ7dBh/UiJ/QZ1a/nI40fc3esEIwJkih/XhhjOmScuXVc0QOrsJkBjVk5es88OdAvD3sJw81dISDJAqSvsdgNWSv0HkaTsrcDCajLGHfUm1uPV8ErTnOTpT6d7RNGvveUYZT3tAaJ8kE0+2e5jABz0Wh9guRttsGNFRORYpchHSPSDFuRfchrtmza4k3kwEAzwgg23NSja6LSRId5xn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+Dmcm484v96Y/ITiI1aUaOcFBzzWps1XRe66KEL+iFaXnTlenjIm8R/l74YZHQ5v/j07T8usVgp+bQfnnYwubd8iqeu7LFoAyOQJx32/v+1rG/lz96J1OW6/PsGMWLg== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 411af27c-75dd-411a-c801-08dcb10c4483 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9003.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2024 02:55:42.9663 (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: bCcS8b27bCaffwYoX/uPWZWTUf83u713HFABREfUiYu2cUJ+dGZpHWQgITxgCCbNkzbPFQXc4ldgTwKng3AJ9hxaU5uUuRnmxFnxffWp328= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6483 X-Stat-Signature: gshqi6mcyh1fdnmw898x1jeutm7bpzqj X-Rspamd-Queue-Id: 7DE0AA0008 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1722394547-522580 X-HE-Meta: U2FsdGVkX18PrOYnM94m14Szi6UoRXnuhjHFgHp2SxYwJDMWZoZzSezDmwMGqI2Z5txfLNaDxXImEEHOX6GxSujSzmoJrTZU0be7VnG45JUfs9FrcHYA5R20pG4NH3+OzbSRweqkxhkYWFDxrgltg2adQXiXATXkPtcOBs+Ti02/Xe7Er9sHD6rinK+nef5Y2ukpBiFfK95YcL62r0tqLJmfKIZOzApnRrTCJOD7Atj3BSF5fAmDJXA48gI6IKarciWOc5U6rZizEg1Q22nhO1n5kh86aR1ZpdfgTLiCSUn3av7Hu3/moThBGeFgbrEjir+pWDAYqHtrPrMBKI0fe8eUpEujIfOZ4s9czAHB/wfC+UTIkrw2OqjhLTDji1PqXvoFCR+aMc27auRbNiOUwG+rmRricyIJjhU4nn4RzQoamP6kCFC147OdNR8IllMNsC9Xtl/Lx22AnHBdmWb3x7fjIA4P5yRpU9r1d+cKDs5ho1Vg9F3neUb0FqXovlfwoQeYImVQSR7s7qFbpC3P04AHM9Td8JcpswgAF7Jh4GF80sFS6NqiLd6n6Taye5ta4uaKtfAL9/5Ns4wa1hnGnucda/adC6rCBaNejxB3auOewiaH7q2Kttr90HRExYzvz91193D7HFdKfzofA6Ey+yPIzRiLaj+ro2IByFcSpD34kjeklHEXMttoKHVJT/PhKvjv4NKeog0ZinZ2FBX0A9kbD2daPyb8YsJ3xk76B02bZ/+E1MvDP3RzlY/R10BOMEqqNnokgvXbqHf2MnVBR8MQX1xA+/bGnH5YaaudSw3E7+WVRn+OTNq1T03akYqcSf7c0lNa5CPnXEboX01nrPCvbhhzrOy3VaOuuZJD1N7N6lLbQb8wKVi4zEIhUwm6Pg2zJNKjOSPQWJ2jMbFGANCyhHlhmMjqsNq8NJdsqZ5BSjeRrASq760lU+BxaAj93MPrULmtrxg37GGdC7v dNXcNYMy hjRqAdBDUHhLGfZNySmYgrV+11G0x3gwK7XrR+MFMuxRxeX1rgm+x4KOuo/+wpoxixSJVHhzBd4aleTWYlKMfk64RLoC/A3+DdIsW5bsnZdNQJMHEp8LVrJdnACKy0lquu5WCJPAgPz+C+BwPOtVTguLwxDNH6QqmZWM7BnAudpHMtrTn/Px1Ji+HYk9uQ/qsrXdTCDHrFtuyRESlOeVQkdGb1ffMrgXq3Jy0ldqWbdvWduwhu3iL+TGap5GgmDeVsGGjv+9blctXCxDf89srV9t0T4lN8if2NHMUiO4+6QvwczlEmBCn/yiDH0uyGtAcqk7zHAMXRRSbpNZ9dWcD5B+om8Nd2W0gjMMpuGzquesymCBsewdajOcKCw== 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: 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(-)