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 E296BC982D9 for ; Fri, 18 Sep 2026 10:21:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08FCB6B0092; Fri, 18 Sep 2026 06:21:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03FE96B0098; Fri, 18 Sep 2026 06:21:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EBFD16B00A7; Fri, 18 Sep 2026 06:21:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CD8DC6B0092 for ; Fri, 18 Sep 2026 06:21:04 -0400 (EDT) Received: from smtpin08.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2F6C4A0601 for ; Fri, 18 Sep 2026 10:21:04 +0000 (UTC) X-FDA: 85226490048.08.90AC9F3 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) by imf09.hostedemail.com (Postfix) with ESMTP id 9086D140004 for ; Fri, 18 Sep 2026 10:21:02 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=debian.org header.s=smtpauto.stravinsky header.b=oOO60XwY; dmarc=pass (policy=none) header.from=debian.org; spf=pass (imf09.hostedemail.com: domain of leitao@debian.org designates 82.195.75.108 as permitted sender) smtp.mailfrom=leitao@debian.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1789726862; 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=/ZQNv34Ek5Ax6QYdQ7WcoxvzXPWjuzfsPGdEUkXflEs=; b=RC69DYeom04UfS6H8GbgZJvoSroARQ+Aw43UmppUv9lqxGcyk5PlYZ9nfyZTw7q0ffMo0y O3L6cCsi3Xf5NjP9WbUBe4txp5M3SnFgXyoEQ8u0AtcawHVFWDYo0rA8tOmEpgsVsvCzte 3Dyyz5opbCySgvT6dG8v12cDk6jjh8k= ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1789726862; b=gJBvBbURBhazvmAhzB47gaQIpDobq6HHLYQBS+1tHUUSCDl5qoxNPpwVYAa6eklVbfKCOA 0Yj0/gVYB9mMg8oUPMN07K7/SugNbsK4g8z7Kf6QXo4G8vhrDLJGidYUi73fIZ0GXguFeS 4JpFNc7VwN3wH9jv9YvTLL3EQVz34ME= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=debian.org header.s=smtpauto.stravinsky header.b=oOO60XwY; dmarc=pass (policy=none) header.from=debian.org; spf=pass (imf09.hostedemail.com: domain of leitao@debian.org designates 82.195.75.108 as permitted sender) smtp.mailfrom=leitao@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=/ZQNv34Ek5Ax6QYdQ7WcoxvzXPWjuzfsPGdEUkXflEs=; b=oOO60XwY8ERyAwZK1S5h0ToTPQ OWwppHptar6tur502/2Wg9/RCn2+pTXEtbIxFfHSEZlVoELlME73jhYQbNgjqZXZLZlskIwr4BRLo 4KhTvT+ONt5E5DYomWH9sCloKyIcNdSH+jcmjU8hT4oxN+3cPP3FToHvfwgCedBhWkNh93FuDuebg LSCa4XpTARiqYS5ebFHkY+qrfq04Jev8uQkMm22bxOdXL6rKAblbLD/pGi5gzHlrNVhf8kjDvSZ2a DiR2HyXULTC0Etm/1SxcycLYuX1tHXwQnnjP8oldLyI2EF+MMok6nX92fsb8cD8KxXPWvDBGHbwPS JquZVzOw==; 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 1x7Vi1-006eOU-1G; Fri, 18 Sep 2026 10:20:45 +0000 Date: Fri, 18 Sep 2026 03:20:39 -0700 From: Breno Leitao To: Catalin Marinas Cc: Andrew Morton , Jonathan Corbet , Shuah Khan , Randy Dunlap , workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com Subject: Re: [PATCH 3/3] mm: kmemleak: raise min_unref_scans to 3 for verbose auto-scan Message-ID: References: <20260917-b4-kmemleak-doc-v1-0-84fde6d1f749@debian.org> <20260917-b4-kmemleak-doc-v1-3-84fde6d1f749@debian.org> <20260917150443.a872ea0fd692503c53b2b773@linux-foundation.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: rspam06 X-Rspamd-Queue-Id: 9086D140004 X-Stat-Signature: turx85865z7bn5naw6mgf1qznz8y9nef X-HE-Tag: 1789726862-563684 X-HE-Meta: U2FsdGVkX19PJY1C3d0NaGjkz512X98XbBT166kW7IapZJtj/+UuDWwjWumTtUGFyLRpefdDcmoWV4IKFiziQ8OhOwahdFSwrvVxUOSKWveApcxK9Lb2PDgYzYMS4epdP54JLG7LB5ZP5IsNnUKkDmcJSsTVN7o1Uktsw3FH7LyQicX5A5q6noycebr20TKRLTkgDLQDs5MEindM0KEplfQffPd7sswHRFi/M/LZq2JWaNQQoqI3Eq5FohzsIkRv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= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Sep 18, 2026 at 10:21:09AM +0100, Catalin Marinas wrote: > On Thu, Sep 17, 2026 at 03:04:43PM -0700, Andrew Morton wrote: > > On Thu, 17 Sep 2026 06:47:37 -0700 Breno Leitao wrote: > > > > > CONFIG_DEBUG_KMEMLEAK_VERBOSE sends every report to the console, so a > > > transient false positive there is broadcast to whatever collects the > > > kernel log rather than sitting in the debugfs file until someone looks. > > > That asymmetry justifies being more conservative than the general case. > > > > > > Require one more consecutive unreferenced scan before reporting. The > > > only cost is that a genuine leak is reported one scan interval later > > > (600s by default); the value stays writable at run time through the > > > module parameter. > > > > > > Kernels without CONFIG_DEBUG_KMEMLEAK_VERBOSE keep reporting on the > > > first unreferenced scan. > > > > > > I've been running constant upstream kernel with > > > CONFIG_DEBUG_KMEMLEAK_VERBOSE set, and I am still seeing some rare false > > > positive, that goes away with min_unref_scans=3, so, making it the > > > default based on my heuristic. > > > > I'm guessing going from 2 to 3 reduces the false-positive reporting > > rate, but they're still possible. > > > > It all sounds rather rubbery. Why do these false positives occur, > > anyway? Are we papering over a fundamental problem by filtering out > > its user-visible effects? > > The fundamental problem is that we can't do a stop-machine for the > kmemleak scanning. When scanning takes tens of seconds, pointers may > move around memory or registers on other CPUs, so kmemleak could miss > them. It's all probabilistic, hoping that we won't hit the same object > two or three times in a row, 10min apart (for lack of better ideas). We > have other heuristics like checksumming but they don't seem to be > sufficient when testing on a large scale. In fact, in my investigation there's only a single use case where I actually see this false positive, which go away with this new approch. And I have a very solidy test setup where linux-next is deployed daily and run for 24 hours, until the next kernel replaces it. This is on real hardware with some basic workloads, so, in fact the false positive (given the design above) is quite low.