From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 96EA1371045 for ; Thu, 28 May 2026 08:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779956159; cv=none; b=uN6tNOutnf1nUKfoN1GEYQAZxDe/ZoIKpPB/GbS/NRHlEnc2+4YzRuhFNR5zjDo6NRViiH9x4cYOo/Krcn+MZATVl9BM6EZFXPjAOEav3TRGt2J+Cjmi1CpU1shGGC0a0FuLvjSI/P877Wsw7s0pzQHwmgsbtJvyKlXJb43mM+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779956159; c=relaxed/simple; bh=zWQm+Hcba6speClFx1S7UF08eCAwvfju/6jZdjaRhTc=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=hpbksLgiJB++zkjLI9SPjTX/Ia3/u9kBf2x9aqoVpatUISyzpkh+JPIsdegelQZwviX3/JWDcopCLfK3jkDw8ajRTWkoiKulfUKDKzkr8FSNXPuS7kJioANaNCDkpDN3aih8GSFD19+fgMR6SD+cCQoTZ/U6i0nbIGXpTHv0NaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aSlrDZfb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aSlrDZfb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14B7A1F00A3A; Thu, 28 May 2026 08:15:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779956158; bh=rYivG+khnFG9l2jgbn4uQMtFgxumzEgDULtiQJb8tf8=; h=Date:From:Subject:To:Cc:References:In-Reply-To; b=aSlrDZfb/5RsiSrR8rmCTTypOOOKFVgi9zYKSlF3sd4mgApK9155eC+hyaurxtkfI ruaWl73zB/O9mV3KdPmWUXwN6mLqeg+gky6zhChycDMWgVy7NsSFdesVY1NCV8yIeG 91bBe9LEqG1fgxU2uNTnyd2RntEr3klMjimGrw/nhroQ3CnGqlV4+RBtW+8uNihRwH 4rBRzbbIyfIlS7yYx98cpHuZyK8YSY8fOoP9Sf1SBFcWTUWgkNuPvrJM1nlvlTOPQu pDd2XGZAVKM3AXDIyor9vr61JDAhikEdDnrxrOpIteMevFHP+i/pKqnVPjp8pRkHZ7 h0tKdLaXs4YnQ== Message-ID: <98aadcdf-6062-4aea-9b33-e64b4b613618@kernel.org> Date: Thu, 28 May 2026 17:15:33 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Harry Yoo Subject: Re: [PATCH v3 1/2] mm, slab: add an optimistic __slab_try_return_freelist() To: "Vlastimil Babka (SUSE)" 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: <20260522-b4-refill-optimistic-return-v3-0-2ba78ec1c6ed@kernel.org> <20260522-b4-refill-optimistic-return-v3-1-2ba78ec1c6ed@kernel.org> Content-Language: en-US In-Reply-To: <20260522-b4-refill-optimistic-return-v3-1-2ba78ec1c6ed@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/22/26 11:23 PM, 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. So > we just put the slab back to the pc.slabs list. It's no longer likely > that the list will be empty now, so remove the unlikely() annotation. > > However, also change that code to add to the tail of the partial list > instead of head to match what __slab_free() did and avoid a regression, > that was reported for the earlier version by the kernel test robot [1]. > This change will also affect slabs which were grabbed from the partial > list and not refilled from even partially, but those should be much more > rare than a partial refill. > > [1]https://lore.kernel.org/all/202605112204.9382cecf-lkp@intel.com/ > > Reviewed-by: Hao Li > Signed-off-by: Vlastimil Babka (SUSE) > --- Reviewed-by: Harry Yoo (Oracle) -- Cheers, Harry / Hyeonggon