From mboxrd@z Thu Jan 1 00:00:00 1970 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A78AC43458 for ; Mon, 13 Jul 2026 12:52:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92E836B0005; Mon, 13 Jul 2026 08:52:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DF326B0088; Mon, 13 Jul 2026 08:52:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F8766B008A; Mon, 13 Jul 2026 08:52:46 -0400 (EDT) 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 5C97D6B0005 for ; Mon, 13 Jul 2026 08:52:46 -0400 (EDT) Received: from smtpin14.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EA2E78AFF8 for ; Mon, 13 Jul 2026 12:52:45 +0000 (UTC) X-FDA: 84983742690.14.27068B0 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) by imf21.hostedemail.com (Postfix) with ESMTP id 55DAC1C0003 for ; Mon, 13 Jul 2026 12:52:44 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=debian.org header.s=smtpauto.stravinsky header.b=Qk7WOcen; spf=pass (imf21.hostedemail.com: domain of leitao@debian.org designates 82.195.75.108 as permitted sender) smtp.mailfrom=leitao@debian.org; dmarc=pass (policy=none) header.from=debian.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1783947164; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KrzBFQL/kup5HSstLlQrUOdaDnkU3DG0GMPE0mQF9Ek=; b=uBsI3zx1wS2IYVuzPcYPTq8AxCyea/hzQ0sA/nSyzaVObZKJhPrCajW2LP+VGIbG3ugCjF uICSt20M773JDSjO5JfoHCoj/4c18yNV/eKvg7R5CNJSlgsekYYOQsc2e5ZXgueDCKgjBC BTNVQ/qPlyqGB4tMH947vIunu8Qo9X4= ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1783947164; b=JIAMr4daiQdBBdN5xEseHIi60Ym+uTE3yTJDgdy0atRCA66a8+EUkple58oHyj+3V8PAgZ dobsNvVb63q9sHyLYY5Z19ZLdVUW8lHIDOEgKiMzu/EwlQzEjnoNTH1M8xaU61E5su0py/ hCjkk/u8tVlgovepCoubU1ywEUi3Po4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=debian.org header.s=smtpauto.stravinsky header.b=Qk7WOcen; spf=pass (imf21.hostedemail.com: domain of leitao@debian.org designates 82.195.75.108 as permitted sender) smtp.mailfrom=leitao@debian.org; dmarc=pass (policy=none) header.from=debian.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KrzBFQL/kup5HSstLlQrUOdaDnkU3DG0GMPE0mQF9Ek=; b=Qk7WOcenP8TnPsWFDAQmOgcZLQ 20+qqf/63rlyGlpxez39tkeLyKC8Z+wQFtQiXEQZPjL1rEXLLanNK9TMtv7ZiUK46cLKfaWa7NoUm SxITnK2q6daJpcsN2uzpU8OxbcXz+Y8Csn+011MGei1PKdpc9it+eUuDpGvR3sN7M7CtejltAvEPs DyF+KzSI2FzcXaqc+rwqn0gOeabrl2YDKSjru0ZK6lbxbb5TN1DWqZf+o0fheBDTzlGCeNb5MI+sC CiNtpB1cCDH4UAmBtiUTtMEzCwNdsamqcdY1C/Qj3r409qPnFITZujeIMHbQVLmivixjNdtiKK8ye X5RPWREQ==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wjG99-001VpD-2l; Mon, 13 Jul 2026 12:52:32 +0000 Date: Mon, 13 Jul 2026 05:52:26 -0700 From: Breno Leitao To: Geert Uytterhoeven Cc: Catalin Marinas , Andrew Morton , Jonathan Corbet , Shuah Khan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Shuah Khan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH 1/4] mm: kmemleak: confirm suspected leaks with a second scan Message-ID: References: <20260713-catalin_pto-v1-0-5b93b1131089@debian.org> <20260713-catalin_pto-v1-1-5b93b1131089@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Debian-User: leitao X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 55DAC1C0003 X-Stat-Signature: ruuyrtmp69i6zq7rrjrjm1jki9rosafo X-HE-Tag: 1783947164-831754 X-HE-Meta: U2FsdGVkX19q5KyDBGngtNmwUbRsLxUVZ0TRIzVnqkxOcWWN5tGHSbt9VWEohmE+pnVK+VIT9g02CG4uJ7cC6GgvIHnctmYKW4kSo8QLrI5NL60Hz5tv/YMfcrs1qNwaet+7ZsTgo3zmwbAYgJGUgv8OOqoAdF4YVA8IM1ZyU1HtDYNvo2cHyq7HJH8pENBok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PSI0C+lhhxGwrzDO1J0Xo8fjXPkHnWD7Gath1EomTkUXnhh4O/TMJrb18JnBw89fjlqbJiwYsvWNjv5tHZAJF8w1ShlkwF7mTnW41w5f3+8MXaXU= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: hello Geert, On Mon, Jul 13, 2026 at 02:36:30PM +0200, Geert Uytterhoeven wrote: > On Mon, 13 Jul 2026 at 13:48, Breno Leitao wrote: > > From: Catalin Marinas > > > > The kmemleak marking phase is not atomic. While the object graph is > > traversed, the kernel can modify pointers, free objects or allocate new > > ones. If a reference to an object is moved from one location to another, > > kmemleak scanning may miss it. We have explicit annotations like > > kmemleak_transient_leak() but identifying and maintaining them is not > > trivial. > > > > Given that such transient leaks are short-lived, rather than just > > reporting such objects as leaks, do another scan to confirm the > > suspected objects. If no new leaks are found during the first scan, skip > > the confirmation one. > > > > Signed-off-by: Catalin Marinas > > Assisted-by: Claude:claude-opus-4-8 > > Signed-off-by: Breno Leitao > > Cc: Andrew Morton > > Thanks for your patch! > > For how long does this postpone the reporting of a real leak? No, it doesn't postpone leak reporting by default. The default behavior remains unchanged. This patchset introduces two features. The first (patch 1) performs an immediate rescan within each scan cycle when potential leaks are detected, filtering out transient leaks. Each scan takes slightly longer, but a single scan cycle now detects and reports leaks with fewer false positives. The second feature adds 'min_unref_scans' (defaulting to 1), which only reports a leak after it appears unreferenced across min_unref_scans consecutive scans. With the default configuration (min_unref_scans=1), a single scan will still report your leak. if you change it to 2, then, the leak will only be reported if the leak is detected by two scans --breno