From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381013; b=muDKQeMDWidOSvUH7lrJHlkO2Lyxm1XPLzWnTAp+XjrVRvp/bXuAciEnZ13TxFOgtCSm AKIWaO+41z990PUDI8VxlwODqYIgi3TermMWk9avQJeFTcXR6xcU/Aj3F/k+Uo7C5CQti XTha+vbe+7DMcsa8S6Upma/9M6AWshpb3QkRhzuF7QnVQ+hKvNXNWmvXvqTpcNkJ+jvHV J5jFmJDR2m2YednqIgUCcPNcZLUiqr6PKAxxfYbGRCMjQT24jAzsuF2mxXGnJxorguBTW IQMy+1Hp/y9vfAbbnS9ses2rKNyBGJL1mQ1oH8O4nuzfMfUN/CfS11VzylJ1TJ7KFAw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381013; h=DMARC-Filter:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=cC6FZNHgps4robaOTwrAIIRi8afOMaywj0zd6wKBa7c=; b=1Y8rociSluV37hoCoSesjWgRkM65t26v2tuVI1OAYov82b4N3NyiHE8zBv2QNbsaV303 aYIC+e+CdeNNXhH6/fAulGnKTM0DUzTrHFfVLa/ILQ5USj9nOWedfhu0rBca4Ng8knseT yPeWLutpcSe9bkVkQ43mcgPk/1uiouIZ4se37+r7r+hdYkKtWXBizae4FRUwhxf4ojKpG 4zEK9jSHc3qJ2AQ7pbmD1HoHycso9nWL98iyiBSQ2lQEEi0y1cFKS85yfkcYq/PtkR6N8 CbBNo9ix+XWd+kiE+ixv+98AdXLfG7NENmGBjnluLP42d5xY46GmRcRtPafkYRiXl2A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=FMjtYk8r; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C928B606A32C for ; Fri, 4 Dec 2026 10:43:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C928B606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=FMjtYk8r Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2C20114BF; Fri, 4 Dec 2026 02:43:29 -0800 (PST) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4AE383F86F; Fri, 4 Dec 2026 02:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796381012; bh=N/iFpVK3OKjqIu2WCbqGO9jVhxsyPxKp4/zcuO+/+JQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FMjtYk8rMk/UWHNophrYEAiZfbMd8WHvXOS6+I2RIIbg51RMxMPA8CCExWQUn+Ql9 FFureDrX1ru5WRfjMjV3j2vqa6a7Wk8MssO8dgjBiH/ZjsIRAQhn33MF2TA8SkE21T retEW9NPSillm5AEteEkyTmhnZAlG8p3A7IS6cNM= Date: Fri, 4 Dec 2026 10:43:27 +0000 From: Catalin Marinas To: Harry Yoo Cc: "Vlastimil Babka (SUSE)" , Nguyen Ngoc Thang , Andrew Morton , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Suren Baghdasaryan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, syzbot+527fed49e5b988882c9a@syzkaller.appspotmail.com, Breno Leitao Subject: Re: [PATCH] mm/slub: don't let kmemleak report rcu sheaves Message-ID: References: <20261113151837.123795-1-ngocthang2710.1999@gmail.com> <0e626675-c6f9-40d7-a4ae-de069154ada2@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Nov 25, 2026 at 02:10:45PM +0000, Harry Yoo wrote: > On Wed, Nov 18, 2026 at 04:06:29PM +0000, Catalin Marinas wrote: > > On Tue, Nov 17, 2026 at 11:05:28PM +0000, Catalin Marinas wrote: > > > diff --git a/mm/slub.c b/mm/slub.c > > > index 45e077c7526c..13b8e57d6dae 100644 > > > --- a/mm/slub.c > > > +++ b/mm/slub.c > > > @@ -6278,6 +6278,14 @@ bool __kfree_rcu_sheaf(struct kmem_cache *s, void *obj, unsigned int free_flags) > > > > > > local_unlock(&s->cpu_sheaves->lock); > > > > > > + /* > > > + * A sheaf allocated with kmalloc_nolock() is not tracked by > > > + * kmemleak, so neither its objects nor the rcu callback queued > > > + * after it would be scanned. Fall back to defer_kfree_rcu(). > > > + */ > > > + if (IS_ENABLED(CONFIG_DEBUG_KMEMLEAK) && !allow_spin) > > > + goto fail; > > > + > > > /* Don't wake up kswapd, it will cause deadlock under pi_lock */ > > > empty = alloc_empty_sheaf(s, __GFP_NOWARN, alloc_flags); > > > > > > > For the objects queued in a sheaf, rather than the !allow_spin fallback > > above, it's simpler to move the kmemleak_ignore() call in > > kvfree_call_rcu() before kfree_rcu_sheaf(), so they are treated the same > > as on the non-sheaf path. > > No strong opinion on this but kmemleak_not_leak() would let kmemleak > track objects queued in a sheaf? > > Wondering it'd make sense to mark bnodes with kmemleak_not_leak() as > well instead of calling kmemleak_ignore() on all objects. bnodes are allocated with __get_free_page() and these objects are not tracked by kmemleak. Instead we'd need kmalloc_alloc/free() on bnodes but I think the existing kmemleak_ignore() is simpler, it covers other cases as well. -- Catalin