From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 168234611DF for ; Tue, 20 Jan 2026 18:47:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768934871; cv=none; b=qq1f2dY/2nGjNntf1nSvewxFKp2iXvK/NdAo8PExzTfan8Yzg7A7tBDBtAsMW1dqoH09/qYMbPaHXiLTp9IyqQ1TQf/xDXJv9HflnQUq79d7DiIBTVMn5VkLG45UMURzyBkd6ZhFgpaZX+KzAaa3YUOwuLSA1ngsT7C2q4IiZVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768934871; c=relaxed/simple; bh=CDhyY+lp92Rh286QAW/XP/ZhroygHch5zAJeleD2L8g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YtQ7NFJKME5gH/UT/U9VqzJGxW7lHS0Wwum3dmSJ2PNHv7EGnDs5DMVXWrwkQlIH3G3lu7JsVVhOidrxNoJ/nlmCx1REDQPaX8yzJ+/DA0xIn4TeNcrROyIznt3Vnh7v4AW+cBz10piOjONep0DUBakcNpXXQfX7TbCBMsFkp0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-7cfd9b898cdso3228658a34.2 for ; Tue, 20 Jan 2026 10:47:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768934868; x=1769539668; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cyvv5bVOKq5q2ikgZwkotwgP6l+kB/mtu+tHV4I/d8o=; b=K0h6rS9RNKBiPJKPc+mh1XBBVCJ+iGTyzSq4xO6z0Uq2hDvlfuhoN1x/Nkmz5ke9kk 47d2XzzUHQG+DdYy8Vyb33kia8meGRtEAAy+JtwX1I6SDYuVD5WeMlShIDqFX3UV2gLq ffJc1MtMCIXnYHdng0vaqLdOutTSWcfy9058WVCT48OqhELNJj+V9dId7xp6p9LwHZll cegQkr+oTAItTKw7ZhyZ5itun+l0ooyZaakeRKxUOSZwZWNt+qiwyoW51BK057F4P4co 4s7GoafFO5uKeDXH5R+pBBBbN/jNPXOuRE8qvQZo8FKkKPqJVBfDkgQh9qPtrfXcHj/E EqjA== X-Forwarded-Encrypted: i=1; AJvYcCVjsXZOXJIli1ZPGWbyb9dO790jyH6IJo2f7voDwodndF1SvCO+3FfRzqO+CZiBjI0aFlH2NUoOlJ38tCc=@vger.kernel.org X-Gm-Message-State: AOJu0Yzj1ZvGK/MhP/XBZctchX01oKNjW+50qTa6JR1+aUPJqYrViNrx OQaTzte1ETkvfOC/ocrWLSxhCR9+ltTJ9j9PAl1Ld+aBaZ5h4jbkS6BI X-Gm-Gg: AY/fxX5/mDunH6NzX0/kjADserLYLPK9hhcTNhrU1XYUcmrXPEt5JDh3D/L4ulGgn2u +V3seBeM5hrziaHPlMdh9sbR7BD0mdgQSFcfqv55CoJbUTMqfU5nk6HkjEi7eANcLp7YHK0Pc9l s0oEeodNFtgcVfIs/ULBwdRQ76/TomQ1lxEUxyDjEGzNpP21x+08tt5kJfRkNPBnink+A6DQSRr d89GRnIGNEqssXfu2zgZHLBSJ8n9xTUBArw8ijAkborrCFqdP2L+bTevvj8uOdK9bMy9X7suIDk mb7zSjgCD2gPAIfw3W/54F798NS7mqKz2w3kE4EM25Cv2AxIaAEor/JcAZWADH6AmS/VwsxiSxi j00/6s+QbZzwTj1EtUVtpBI/rOT1i/0FvU6a2lKASZR0XNcV1qMUzvG7lfYv6ImPd6PbZhrdohA wX4Q== X-Received: by 2002:a05:6830:3986:b0:7cf:da97:57d6 with SMTP id 46e09a7af769-7d140a3d3c9mr1655270a34.6.1768934867912; Tue, 20 Jan 2026 10:47:47 -0800 (PST) Received: from gmail.com ([2a03:2880:10ff:52::]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7cfdf0e956esm8985236a34.10.2026.01.20.10.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 10:47:47 -0800 (PST) Date: Tue, 20 Jan 2026 10:47:45 -0800 From: Breno Leitao To: Vlastimil Babka Cc: Harry Yoo , Petr Tesarik , Christoph Lameter , David Rientjes , Roman Gushchin , Hao Li , Andrew Morton , Uladzislau Rezki , "Liam R. Howlett" , Suren Baghdasaryan , Sebastian Andrzej Siewior , Alexei Starovoitov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, bpf@vger.kernel.org, kasan-dev@googlegroups.com Subject: Re: [PATCH v3 05/21] slab: add sheaves to most caches Message-ID: References: <20260116-sheaves-for-all-v3-0-5595cb000772@suse.cz> <20260116-sheaves-for-all-v3-5-5595cb000772@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260116-sheaves-for-all-v3-5-5595cb000772@suse.cz> Hello Vlastimil, On Fri, Jan 16, 2026 at 03:40:25PM +0100, Vlastimil Babka wrote: > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -7863,6 +7863,48 @@ static void set_cpu_partial(struct kmem_cache *s) > #endif > } > > +static unsigned int calculate_sheaf_capacity(struct kmem_cache *s, > + struct kmem_cache_args *args) > + > +{ > + unsigned int capacity; > + size_t size; > + > + > + if (IS_ENABLED(CONFIG_SLUB_TINY) || s->flags & SLAB_DEBUG_FLAGS) > + return 0; > + > + /* bootstrap caches can't have sheaves for now */ > + if (s->flags & SLAB_NO_OBJ_EXT) > + return 0; I've been testing this on my arm64 environment with some debug patches, and the machine became unbootable. I am wondering if you should avoid SLAB_NOLEAKTRACE as well. I got the impression it is hitting this infinite loop: -> slab allocation -> kmemleak_alloc() -> kmem_cache_alloc(object_cache) -> alloc_from_pcs() / __pcs_replace_empty_main() -> alloc_full_sheaf() -> kzalloc() -> kmemleak_alloc() -> ... (infinite recursion) What about something as: diff --git a/mm/slub.c b/mm/slub.c index 26804859821a..0a6481aaa744 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -7445,8 +7445,13 @@ static unsigned int calculate_sheaf_capacity(struct kmem_cache *s, if (IS_ENABLED(CONFIG_SLUB_TINY) || s->flags & SLAB_DEBUG_FLAGS) return 0; - /* bootstrap caches can't have sheaves for now */ - if (s->flags & SLAB_NO_OBJ_EXT) + /* + * bootstrap caches can't have sheaves for now (SLAB_NO_OBJ_EXT). + * SLAB_NOLEAKTRACE caches (e.g., kmemleak's object_cache) must not + * have sheaves to avoid recursion when sheaf allocation triggers + * kmemleak tracking. + */ + if (s->flags & (SLAB_NO_OBJ_EXT | SLAB_NOLEAKTRACE)) return 0;