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 7E098258CD9 for ; Mon, 1 Jun 2026 03:51:50 +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=1780285911; cv=none; b=RWwqD9RJi+xcC4m22Ll2+ljvKnDeV/E1NlFypURKcujHZdp1w5dFzbouqGlu2jObrkI5NViuFXpz4mPjsD2Fp1CZYBJAx4KInuqe5H6o7k3JY6X4EcOiRXq9KBAlkbMLmAuQc7OOKSUUgva8ci0bGStlEzuwFLnMPfJ+A8w1QNc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780285911; c=relaxed/simple; bh=9WaraIL5XbbLzsgbt1kHcDbeDD9smY5kRk34t+mC6kY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mQvPfgb1fOw6vJmZO/hHpCy+n2n8HF+bpqyUZ2jRpFtvAU1LX7ZiAMhj9UAKXkZwqDrhmc5drFkqdvHslf0bQMpM070o/qvgHE02e8+fUlreqw70tRIQxG/M+AkNDGAq1KioFhcioNmpvN+EDFP+OU3mqNO5T3hWB+xcOe2fg+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U6dkxNLw; 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="U6dkxNLw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6712B1F00893; Mon, 1 Jun 2026 03:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780285910; bh=sLmB4YlFf93jmDEEnyM+0JFZP8CSdyLVyUdrZ5eW/1M=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=U6dkxNLwNu0+fchGsJZOSzyeZe6uHp985VHCDSp/199wRKqvBK/t1dXV8SSpO6LEH WUWVtFposvQtXckX5XsUW1TYzTHSXGROYIT9CvlaEfiKWENY6nbZYz0ix0eyYSATzC pAPFVpsCrTAI55c78o68MMxu1XNZ5oRrM4wNO4GNZlXY5GJ16HQUgYSr256UY86Mji tOpABJfDzXaWcgv6dfjcJsPDCmVBJzm7yK0nahuVCFn9kYOy0qNR9pjQylKBbY2aoI z//xKRKZKoOYtpmtPDsVHDTA5LpxwJ1Zoh+bBFSXUsYpOZfHc6qTYS4vsYf+V0xY5Z 2qbutT5UHdi8w== Message-ID: Date: Mon, 1 Jun 2026 12:51:43 +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 Subject: Re: [PATCH v3 2/2] mm/slub: detach and reattach partial slabs in batch To: Hao Li , vbabka@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 References: <20260529035120.81304-1-hao.li@linux.dev> <20260529035120.81304-3-hao.li@linux.dev> Content-Language: en-US From: Harry Yoo In-Reply-To: <20260529035120.81304-3-hao.li@linux.dev> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------m0RuxEGm2eLyNYdpYZza8Crz" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------m0RuxEGm2eLyNYdpYZza8Crz Content-Type: multipart/mixed; boundary="------------qMU0BPtEeznEhoMt3ZIa9oKo"; protected-headers="v1" From: Harry Yoo To: Hao Li , vbabka@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 Message-ID: Subject: Re: [PATCH v3 2/2] mm/slub: detach and reattach partial slabs in batch References: <20260529035120.81304-1-hao.li@linux.dev> <20260529035120.81304-3-hao.li@linux.dev> In-Reply-To: <20260529035120.81304-3-hao.li@linux.dev> --------------qMU0BPtEeznEhoMt3ZIa9oKo Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 5/29/26 12:50 PM, Hao Li wrote: > get_partial_node_bulk() moves each selected slab from the node's > partial list to the local pc->slabs list using a remove_partial() and > list_add() pair. In practice, the loop often detaches several adjacent > slabs. Doing this individually repeatedly manipulates list pointers > while holding n->list_lock, which causes unnecessary churn. >=20 > To demonstrate this, the counts below show how often single vs. multipl= e > consecutive slabs are retrieved during a will-it-scale mmap stress test= : >=20 > consecutive_slabs_count frequency > =3D 1 277345324 > =3D 2 335238023 > =3D 3 175717884 >> =3D 4 88862337 >=20 > The data confirms that retrieving multiple contiguous slabs is highly > frequent. >=20 > To optimize this, track contiguous runs of matching slabs and move each= > run in a single operation using list_bulk_move_tail(). This reduces lis= t > pointer churn inside the lock critical section. >=20 > Apply the same optimization to __refill_objects_node() when reattaching= > leftover partial slabs back to the node's partial list. >=20 > The will-it-scale mmap benchmark shows a 2% ~ 5% performance improvemen= t > after applying this patch. >=20 > Signed-off-by: Hao Li > --- Reviewed-by: Harry Yoo (Oracle) --=20 Cheers, Harry / Hyeonggon --------------qMU0BPtEeznEhoMt3ZIa9oKo-- --------------m0RuxEGm2eLyNYdpYZza8Crz Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQQQ1ub6gR5ogjaKRmOGXBN6rc5S1gUCah0BzwAKCRCGXBN6rc5S 1qX1AQDwvcX4DdLopuDVFfCQt2rqBy/krXFrTCgCRBFMF3z9ZAEA3npXuTwPm7Rk zvyVNP4WB19wUGPjjRduxsgT9hmZMQA= =wKA2 -----END PGP SIGNATURE----- --------------m0RuxEGm2eLyNYdpYZza8Crz--