From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 60FCE29B200 for ; Tue, 19 May 2026 04:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779163712; cv=none; b=VcClZ96gXpLi3Xm5+668AC9AeIdoceCc9ixGFDx/YKzk+rbatM77xv10RjmKDYvHGWg150a+ooN3VsIywssuWW50xUBtNqYjyF4ggT14AveZk0gSEhfKAYbe2gUmreT6xtsUoOUMVbBU/0zmPx8jxy8CePmJhqF9ftE+dhQJPdg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779163712; c=relaxed/simple; bh=9+9U74/9e6aYtYASGlFsq6JHdr8wTxpRPW6bqWYkMsQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ReNB3yM9Wqlyh4fvN0qo7AShyOtdxSZW81Ix+rI0s66+z/2yI4vb29jI0M1tuyHdgYIX0hW174J2ehLL5s9ueQe3YGtkjSMMSsRAVZddTLqdV0cAcLoKfRPrfgaVuovqCVTjWw6xdCWvhPVmv5Y8WFCED+0nwzh/5XLDCqQutlE= 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=sd8/w6jF; arc=none smtp.client-ip=95.215.58.189 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="sd8/w6jF" Date: Tue, 19 May 2026 12:08:19 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779163707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G8eV7g1JtKUSReNhPrH4xoPwSK6jpCut0GMVwPfzuFc=; b=sd8/w6jFHHxfVX6cIU9JlkugH2JBd1nBFJUtyrJDz9g+jyFMimyjHpuGoD0TK/0YSchd7T ZzFm0AOzMU2qlfHJYlSbUv7igihjWkm9RERvKbO/ng9Z6BCWdv33+3mO99rsUWVaTqVac2 K4cpoZdoKuFoUV77tMOzM3RKMkaRodY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Li To: "Harry Yoo (Oracle)" Cc: Vlastimil Babka , Andrew Morton , Christoph Lameter , David Rientjes , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , "Liam R. Howlett" Subject: Re: [PATCH RFC 1/8] mm/slab: do not store cache pointer in struct slab_sheaf Message-ID: References: <20260516-sheaves-tuning-v1-0-221aa3e1d829@kernel.org> <20260516-sheaves-tuning-v1-1-221aa3e1d829@kernel.org> 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: <20260516-sheaves-tuning-v1-1-221aa3e1d829@kernel.org> X-Migadu-Flow: FLOW_OUT On Sat, May 16, 2026 at 01:24:25AM +0900, Harry Yoo (Oracle) wrote: > The `cache` field of struct slab_sheaf is only read on the slow path > when freeing an RCU sheaf. Storing it in every sheaf is an overkill. > > Drop the field. In rcu_free_sheaf() and rcu_free_sheaf_nobarn(), > fetch the kmem_cache pointer via > virt_to_slab(sheaf->objects[0])->slab_cache instead. > > As sheaf is only attached to pcs->rcu_free once it holds at least one > object, the lookup is safe. Add a WARN_ON_ONCE() in case an empty > sheaf ever reaches the RCU free path. In that case, the cache is > unknown, so free_empty_sheaf() now tolerates a NULL cache argument. > However, the case is never expected to trigger. > > While at it, remove the stale comment in init_percpu_sheaves(). > > Signed-off-by: Harry Yoo (Oracle) > --- > mm/slub.c | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) Looks good to me. This cleanup can save 8 bytes and give us one more objects[] pointer. Reviewed-by: Hao Li -- Thanks, Hao