From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 E1EEA3A874B for ; Mon, 25 May 2026 06:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779691673; cv=none; b=kIOX/gK//QY9T/Lx3w05UhK/iSO1WciGaTASefD+dP1WQlr0hs4TJNYDxYqSFfHEx0VuRsRszPfjBeFVM27C0fY8csfwrH2++nmXmuYge/OqVvNBT5yA4ebi7InkEphah2gg9s56RPl8nBI0ZTaQ0hotjW0dl67klfEp8Pod4nc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779691673; c=relaxed/simple; bh=5WUFF1q25V/iRe/DukOvggKR/vK3EcKEKFjteCACZEY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tSg+1aHwmx7gv1dHdFk/GVLAxlFwUrLU+T4tg2nsFTX8U4Protsr+9vM0h0Gyl7hbf2JagKYlscwYht90EPmuuwtPxFIQEO136TIfZZt5WGldKRU/Nb/cgqnziIjEG4jUg1QvRg23myqSUj/ulcAk2xW8LkfMrkVD3c9yhL8A48= 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=CiU6boug; arc=none smtp.client-ip=95.215.58.186 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="CiU6boug" Date: Mon, 25 May 2026 14:47:34 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779691668; 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=Mh98cAxeer4vCdrfU3hRmg/uMD1K/2JuDcp8hnX2/hs=; b=CiU6bougXvLS+0AVwos1EB1/2nRQxwgUiglmHsy9dnNoopV1KFRKIihhy9DeRO2QTE1FfH tPsbNwZJ0+lKQgPaRIjFMC+P3JoJZ9ovcSh/lLvThW8pmWr9irUAjdn1Fdl/tRgXfOtzdG YoMHoRDhRo/gwPUjFrTiVMbF9vVwRQg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Li To: "Vlastimil Babka (SUSE)" Cc: Harry Yoo , 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 Subject: Re: [PATCH v3 2/2] mm, slab: simplify returning slab in __refill_objects_node() Message-ID: References: <20260522-b4-refill-optimistic-return-v3-0-2ba78ec1c6ed@kernel.org> <20260522-b4-refill-optimistic-return-v3-2-2ba78ec1c6ed@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: <20260522-b4-refill-optimistic-return-v3-2-2ba78ec1c6ed@kernel.org> X-Migadu-Flow: FLOW_OUT On Fri, May 22, 2026 at 04:23:21PM +0200, Vlastimil Babka (SUSE) wrote: > When we return slabs to the partial list because we didn't fully refill > from them, we observe the min_partial limit when the returned slab is > empty, and discard it when over the limit. But it's unlikely for the > limit to be reached while we were refilling, and the worst outcome is to > have temporarily more free slabs on the list than necessary. Just wondering if the empty slabs temporarily exceed the limit and then some objects get allocated from them, would this lead to more fragmented slabs in the node partial list? > So just > drop that code and simplify the function. > > Signed-off-by: Vlastimil Babka (SUSE) > --- > mm/slub.c | 10 ---------- > 1 file changed, 10 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 5816fcfc7a90..074d57c0390b 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -7196,21 +7196,11 @@ __refill_objects_node(struct kmem_cache *s, void **p, gfp_t gfp, unsigned int mi > > list_for_each_entry_safe(slab, slab2, &pc.slabs, slab_list) { > > - if (unlikely(!slab->inuse && n->nr_partial >= s->min_partial)) > - continue; > - > list_del(&slab->slab_list); > add_partial(n, slab, ADD_TO_TAIL); > } > > spin_unlock_irqrestore(&n->list_lock, flags); > - > - /* any slabs left are completely free and for discard */ > - list_for_each_entry_safe(slab, slab2, &pc.slabs, slab_list) { > - > - list_del(&slab->slab_list); > - discard_slab(s, slab); > - } > } > > return refilled; > > -- > 2.54.0 > -- Thanks, Hao