From: Hao Li Date: Tue, 7 Apr 2026 11:59:33 +0000 (+0800) Subject: slub: clarify kmem_cache_refill_sheaf() comments X-Git-Tag: v7.1-rc1~165^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51274836193a661a3f39e7f10629d5978a61bbfb;p=thirdparty%2Fkernel%2Flinux.git slub: clarify kmem_cache_refill_sheaf() comments 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 Link: https://patch.msgid.link/20260407120018.42692-1-hao.li@linux.dev Signed-off-by: Vlastimil Babka (SUSE) --- diff --git a/mm/slub.c b/mm/slub.c index f896cdb413835..98d473f5c7018 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. */