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 9478A345CAE for ; Thu, 14 May 2026 12:54:49 +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=1778763289; cv=none; b=SwxdwwDFl8lcz5UjI1/ylrGyElJk6a+yTX/kTtdX4rGwGfAk6razoDWvZla8BB96ug4xDAnHsxuwFuJVfQAKeyIYxPytimJjtCOu2h9dkc16rwQSrWE9uDcJyKCEjIVbRHENoT9rtpwLddROx9A1x5TM1xTXB1iDiNd0ZsUUMZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778763289; c=relaxed/simple; bh=EK6fP//EqCnlEnafeuGcNvXM4mmM1lfqv269NQoHluo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KaR6q6BOlCZzoOZ6gmCKana3bozTDYuMQ3BoEUeL6eW/lFv2ak8rMjOhHAA6JflEhdNOXchMX5eWaF5IrjEw44G2VuSREWj6A5t/nvKrcxcypLIiJQvjwd1VXcLuac0mcWP1WwuOrhnm+WWYIw1EHsxQLzp49iMS1t5Ido5QF4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ekvMJoWt; 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="ekvMJoWt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B5E2C2BCB3; Thu, 14 May 2026 12:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778763289; bh=EK6fP//EqCnlEnafeuGcNvXM4mmM1lfqv269NQoHluo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ekvMJoWt277faH4jeuTl0fCcIJawazhJlHvYHG+h98rM+cbNY3RUyfpGInoa4DRhf odthu4Y7UvwYafDJhLtkTtBqTvWiESIfskgaihO0YTRi56xlgbLyNpgW5RAw8aK1Oi 5UPqlaVU0bSBQ171LH/Da5Ffxrn4b8o2MV2fTNYBFZBtv5RNXQjx4g+auy9BSnKQ2O v6+RCp2NCpxm+hgLtiqp0VAMHDDAfWOpzsI27HdDj/VKXg/IwYOPh1odDKlBfInSmd 91KzIu/TqCNGedQJ/qE/UxNUQ//blDB6gKO2QHaWaM2X7rTc3qNFlpQvZkg8qpabzn AZO1DKbX6Ok1g== Message-ID: Date: Thu, 14 May 2026 14:54:45 +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 RFC v2] mm, slab: add an optimistic __slab_try_return_freelist() Content-Language: en-US To: "Harry Yoo (Oracle)" Cc: Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, hu.shengming@zte.com.cn, Vinicius Costa Gomes References: <20260427-b4-refill-optimistic-return-v2-1-1672467a792d@kernel.org> From: "Vlastimil Babka (SUSE)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/12/26 07:49, Harry Yoo (Oracle) wrote: > On Mon, Apr 27, 2026 at 11:42:57AM +0200, Vlastimil Babka (SUSE) wrote: >> When we end up returning extraneous objects during refill to a slab >> where we just did a get_freelist_nofreeze(), it is likely no other CPU >> has freed objects to it meanwhile. We can then reattach the remainder of >> the freelist without having to walk the (potentially cache cold) >> freelist for finding its tail to connect slab->freelist to it. >> >> Add a __slab_try_return_freelist() function that does that. As suggested >> by Hao Li, it doesn't need to also return the slab to the partial list, >> because there's code in __refill_objects_node() that already does that >> for any slabs where we don't detach the freelist in the first place. >> >> Reviewed-by: Hao Li >> Signed-off-by: Vlastimil Babka (SUSE) >> --- >> Optimizes the current refill leftover handling in a way that should have >> no downsides, so we have a better baseline for any further changes (e.g. >> spilling or caching the leftover) that involve some tradeoffs. >> >> Git version here: >> >> https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=b4/refill-optimistic-return >> >> It's based on slab/for-7.2/perf with "mm/slub: defer freelist >> construction until after bulk allocation from a new slab". >> --- >> Changes in v2: >> - rebase to slab/for-7.2/perf, drop RFC >> - simplify to reuse the existing reattaching to partial list (Hao Li) >> - Add R-b from Hao Li, thanks! >> - drop the stat items - they serverd to verify the optimistic path was >> succeeding, but are too detailed for mainline >> - Link to v1: https://patch.msgid.link/20260421-b4-refill-optimistic-return-v1-1-24f0bfc1acff@kernel.org >> --- > > Looks good to me, > Reviewed-by: Harry Yoo (Oracle) Thanks! > with a few typo fixes below. Fixed up.