From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 C536A3AC0E5 for ; Tue, 7 Apr 2026 12:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775563258; cv=none; b=CzTpHFa6rcOWrtYz/AYz4bg7yIf+8BOtGsQv18s+8dJg7v85Bpbh71cbnL14VxCFCN1NJofEm6+HXkLNjFGrULu9ZmatulGtzcLnnAq3WNBn7O+6uGrOTu+jSnwwDxTarzjlgIm9d2J++qU+/4Qtk9IIfB3q30KHll9ZnfUw80M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775563258; c=relaxed/simple; bh=QH9ratQcdUw66qSKz0mV5rn9MNLiocknk058uIWiTWg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VM6FdDfQ4HO6vf/H9RUjT2fFXo6iMK2tY5pb7qmZqxbueNuEvOeMiEZjomJ0gRetY9HC4FwBqcgQfYjhSdf0/RMevOhiiIExiUPQ0LiYuMv1s1NUM8T3jm+Q+/q0J62HLUVesxq/biP9xw9g6+iriejCUckI3vuJgSwIPsoBS20= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mqob4GRw; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mqob4GRw" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775563254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=b9UfGcLfPBkl5LZ6M7qHhMwuKYJ679JiDoSUGxGAA3s=; b=mqob4GRwftjlJYHxVKdz8LgCuBNjsj1eFTHvmEi5ZYhuIJdD8qaFzbOB3/nZDIVB/O0NBu 4pNT0qDVrpEkwMyglQ18m0FIgiRdb/JjdCFuUt5P9onFaPuEPeWrxd3dRNx0s/jDiBtHDn dn0qT1RZ1TqpnZuXgm6wSJstxJpz09w= From: Hao Li To: vbabka@kernel.org, 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, Hao Li Subject: [PATCH v3] slub: clarify kmem_cache_refill_sheaf() comments Date: Tue, 7 Apr 2026 19:59:33 +0800 Message-ID: <20260407120018.42692-1-hao.li@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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! --- 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. */ -- 2.50.1