From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A6003AA4FC for ; Tue, 7 Apr 2026 12:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775565611; cv=none; b=OmRDbdZ5UolmisXIip3yqQN8kLfMweEmBl7yi8m4NLoOGdBzo59++dw6bW6PGfk7X6XDSkIwCJkKVOroNT2kEjQ31rrjmLyPgwgWhH2vnCUDGWGUFRq08l7mvBJovF4ch/FSqUGtMRKvQMId4rAl8HxM1F6ce1pUXu3EZ0YnfW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775565611; c=relaxed/simple; bh=MjKTZvgcsa+0D+fv/ckBA0TQ+h5FwjHVyuFzDvvnDd8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sO2Uf/Zx8/rvsCN+00PbtItY5JP0mDbEPX8uFtYKF2e89+l4duP4r9ZyWrchQaEXg3cIY3/4feL9W8YL/eaRLm2VTcxqDPltXgZbdQEhppaATTJr776A07oay1W8jw/5Sy7WXNq1AlIUJF9jMTgjMg6GmCV2nB4lmSBqdk8wrYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XmrTNmWA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XmrTNmWA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AF03C116C6; Tue, 7 Apr 2026 12:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775565610; bh=MjKTZvgcsa+0D+fv/ckBA0TQ+h5FwjHVyuFzDvvnDd8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=XmrTNmWAF7+UGEO0+jM/dWHCTDewiOoYwE6o1rhI5tRqI7Rooar+ZAL5QK1X2pRJS j5gLDOpMV19Gd9oNijz+jgr4PzEaaIO+KsTvHtX6zh9Tj02kYoyhZAvJjNC0/dPqOU nt56lsPzrOFtu2jvy/etLQwO/wjfHZrrCRNZG0m2QeIszrI2F0JoMkjGE6i5LqbjAB UDM+N3/Rf5XLphUNElSB7FTiiH0fC+Ar6lVrBYieKSUJbuLfe3f67OPKs3YuRFcAdm DIiBtpfB16dwGdfsZoGM+UqpS4XzG23N5MH1jXZxwbgZNBi7waEZ4si3ckPYiOnMyR kwPn+cqE8oy8Q== Message-ID: Date: Tue, 7 Apr 2026 14:40:07 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] slub: clarify kmem_cache_refill_sheaf() comments Content-Language: en-US To: Hao Li , harry@kernel.org, akpm@linux-foundation.org Cc: cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20260407120018.42692-1-hao.li@linux.dev> From: "Vlastimil Babka (SUSE)" In-Reply-To: <20260407120018.42692-1-hao.li@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/7/26 13:59, Hao Li wrote: > In the in-place refill case, some objects may already have been added > before the function returns -ENOMEM. > Clarify this behavior and polish the rest of the comment for readability. > > Acked-by: Harry Yoo (Oracle) > Signed-off-by: Hao Li > --- > Thanks Harry for good suggestion! Thanks! Added to slab/for-next > --- > mm/slub.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 4927407c9699..92362eeb13e5 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -5120,12 +5120,15 @@ void kmem_cache_return_sheaf(struct kmem_cache *s, gfp_t gfp, > } > > /* > - * refill a sheaf previously returned by kmem_cache_prefill_sheaf to at least > - * the given size > + * Refill a sheaf previously returned by kmem_cache_prefill_sheaf to at least > + * the given size. > * > - * the sheaf might be replaced by a new one when requesting more than > - * s->sheaf_capacity objects if such replacement is necessary, but the refill > - * fails (returning -ENOMEM), the existing sheaf is left intact > + * Return: 0 on success. The sheaf will contain at least @size objects. > + * The sheaf might have been replaced with a new one if more than > + * sheaf->capacity objects are requested. > + * > + * Return: -ENOMEM on failure. Some objects might have been added to the sheaf > + * but the sheaf will not be replaced. > * > * In practice we always refill to full sheaf's capacity. > */