From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2974FC36010 for ; Fri, 4 Apr 2025 23:56:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EA846B0008; Fri, 4 Apr 2025 19:56:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09A986B000A; Fri, 4 Apr 2025 19:56:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECAF06B000C; Fri, 4 Apr 2025 19:56:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CF1E86B0008 for ; Fri, 4 Apr 2025 19:56:33 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E316BB9940 for ; Fri, 4 Apr 2025 23:56:34 +0000 (UTC) X-FDA: 83298023508.17.C551121 Received: from mailrelay6-3.pub.mailoutpod3-cph3.one.com (mailrelay6-3.pub.mailoutpod3-cph3.one.com [46.30.212.11]) by imf21.hostedemail.com (Postfix) with ESMTP id 909561C0006 for ; Fri, 4 Apr 2025 23:56:32 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=konsulko.se header.s=rsa1 header.b=3VIYYXKd; dkim=pass header.d=konsulko.se header.s=ed1 header.b=EGZBV+pN; dmarc=none; spf=none (imf21.hostedemail.com: domain of vitaly.wool@konsulko.se has no SPF policy when checking 46.30.212.11) smtp.mailfrom=vitaly.wool@konsulko.se ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743810993; a=rsa-sha256; cv=none; b=PBzFURROdt/yenr7xv6TULaBnx2XaSmuEUFbaH2LtiFs0Fl0BeAPrFOP4Iin1XZI8cJTKO //raV0yDOg9rONbd8Qe5LTbmYCBddotiype/ic0StZlDbgU2h042Qv+pdAZ+YsZWuUqynZ GpAqM3d50RUMWB2o46SF7Okj1eg/QMM= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=konsulko.se header.s=rsa1 header.b=3VIYYXKd; dkim=pass header.d=konsulko.se header.s=ed1 header.b=EGZBV+pN; dmarc=none; spf=none (imf21.hostedemail.com: domain of vitaly.wool@konsulko.se has no SPF policy when checking 46.30.212.11) smtp.mailfrom=vitaly.wool@konsulko.se ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743810993; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=qzQN+IMWDuFpF7slD5mT1kgB+W4w8nOOQ8hkPHAhRB0=; b=fvydGaljYblLKQ+fPltd1h3sPnG84tG1uRq/evkIrTbV6nrrQg3dPUvVjtzB2k7XPo12nX YdOjtGYyVL9glq2a87+g+gkAxeU4Wc/ZEiKYfH1nRbvbsKsDIuxuyZDKdaW23r8NTUMhBx WU1px+SwSBxtkltmiv7YBpZ/YHJ+HhU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1743810989; x=1744415789; d=konsulko.se; s=rsa1; h=content-type:subject:reply-to:cc:from:to:message-id:mime-version:date: in-reply-to:from; bh=qzQN+IMWDuFpF7slD5mT1kgB+W4w8nOOQ8hkPHAhRB0=; b=3VIYYXKdNmo0a8XnB8OEVSxokuVsSQqF6nvizKNuh3rHD/Pa0l58ZN+XEx00Xlf0JzzGYemdNVfdQ 0QjfIYnckdT6LmW2LrJM3IL6VnReGafWD0r4EAtbeZjPM7/NNWmUarRyjFytIMtIVAPTnPBRf1iIAR 4EXcbrRl4dpa+xGNEbCJPtsFuJ0cjdNLXCTyzAE7k6yRTaPulSzSPKHZ/tI7x5+R6AVOoOw4MspxoZ gQyKTl+oZ3S1EDRqKHy5vFAwE6wVjVOuxlTPNHR4wr8ZELz1qwbUaMMcmtiumgMRF1UmfZA8K3tOXG AHnzwQZoNr4ATlTs0mZm4UmMWLpc5cA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1743810989; x=1744415789; d=konsulko.se; s=ed1; h=content-type:subject:reply-to:cc:from:to:message-id:mime-version:date: in-reply-to:from; bh=qzQN+IMWDuFpF7slD5mT1kgB+W4w8nOOQ8hkPHAhRB0=; b=EGZBV+pNwS65jPgwyjIpVTlKQwjdvBERUujNalJiyXMye+IDrpa6msfbADHqczq3GrwTQ4nYy82rC B9as3U+AQ== X-HalOne-ID: 6d0ec9e8-11b0-11f0-a0b9-417246ffdc90 Received: from onecom-webmail-backend-production-7b88b644bb-dgx4d (service.pub.live1-k8s-cph3.one.com [46.30.212.67]) by mailrelay6.pub.mailoutpod3-cph3.one.com (Halon) with ESMTPSA id 6d0ec9e8-11b0-11f0-a0b9-417246ffdc90; Fri, 04 Apr 2025 23:56:29 +0000 (UTC) X-Originating-IP: 90.233.218.222 User-Agent: One.com webmail 48.0.11 In-Reply-To: <20250404200321.GB373778@cmpxchg.org> Date: Sat, 05 Apr 2025 01:56:28 +0200 MIME-Version: 1.0 Message-ID: <1743810988579.7.125720@webmail-backend-production-7b88b644bb-5mmj8> To: "Johannes Weiner" From: "Vitaly" Cc: , , , "Nhat Pham" , "Shakeel Butt" , "Igor Belousov" Reply-To: Subject: Re: [PATCH v2] mm: add zblock allocator Content-Type: multipart/alternative; boundary="----------125718-1743810988579-1" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 909561C0006 X-Stat-Signature: orywixe6gfuycjsz93n39x3o95jqocjj X-Rspam-User: X-HE-Tag: 1743810992-668714 X-HE-Meta: U2FsdGVkX183FnJgTX/TwDddV4oD+50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9UMUm4cwvG1eB6q1wA4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a multipart message in MIME format. ------------125718-1743810988579-1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Hello Johannes, Den fredag 4 april 2025 kl. 22:03:21 +02:00, skrev Johannes Weiner : > Hello Vitaly, > > On Fri, Apr 04, 2025 at 09:28:13PM +0200, Vitaly Wool wrote: >> zblock is a special purpose allocator for storing compressed pages. >> It stores integer number of compressed objects per its block. These >> blocks consist of several physical pages (2**n, i. e. 1/2/4/8). >> >> With zblock, it is possible to densely arrange objects of various sizes >> resulting in low internal fragmentation. Also this allocator tries to >> fill incomplete blocks instead of adding new ones, in many cases >> providing a compression ratio substantially higher than z3fold and zbud >> (though lower than zmalloc's). > > Do you have zswap/zswapped meminfo metrics from these tests? Yep, and those look somewhat similar: - zblock: Zswap: 234128 kB Zswapped: 733216 kB - zsmalloc: Zswap: 286080 kB Zswapped: 774688 kB >> Since zswap is used starting from minute 21, this gives 9% in average in= >> advantage for zblock. > > This might be the linker step swapping out source files that are no > longer needed. Do you have metrics for zswpout and zswpin as well? I don't think so, the logs show that the compilation is ongoing. Then again= , we're just running out of RAM at that point. Regarding the zswpin/zswpout, zswpin numbers are marginal with the compilat= ion test and zswpout numbers are slightly bigger for zsmalloc (average ~50k= vs ~49k). The numbers for the stress-ng test (stress-ng --vm 4 --vm-bytes 8G --vm-kee= p --timeout 10m --metrics-brief) are roughly the same: - zblock:=C2=A0zswpin 9870143 zswpout 10642176 - zsmalloc:=C2=A0zswpin 10642941 zswpout 10432625 > My concern with this allocator, and the other alternatives to zsmalloc > before, is the following: > > You might be faster at allocating objects. But if storage density is > worse, it means you have to zswap more pages to meet the same incoming > allocation demand. That means more object allocations and more > compression, and often a higher rate of refaults and decompressions. I understand. It looks like the storage density is comparable, and for 16K = pages zblock may even be doing a better job, see above. ~Vitaly ------------125718-1743810988579-1 Content-Type: multipart/related; boundary="----------125718-1743810988579-2" ------------125718-1743810988579-2 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8
Hello Johannes,

Den fredag 4 april 2025 k= l. 22:03:21 +02:00, skrev Johannes Weiner <hannes@cmpxchg.org>:
> Hello Vitaly,
>=C2=A0
> On Fri, Apr 04,= 2025 at 09:28:13PM +0200, Vitaly Wool wrote:
>> zblock is a = special purpose allocator for storing compressed pages.
>> It= stores integer number of compressed objects per its block. These
=
>> blocks consist of several physical pages (2**n, i. e. 1/2/4/8).
=
>>=C2=A0
>> With zblock, it is possible to densely= arrange objects of various sizes
>> resulting in low interna= l fragmentation. Also this allocator tries to
>> fill incompl= ete blocks instead of adding new ones, in many cases
>> prov= iding a compression ratio substantially higher than z3fold and zbud
>> (though lower than zmalloc's).
>=C2=A0
> Do you have zswap/zswapped meminfo metrics from these tests?
<= div>
Yep, and those look somewhat similar:
=C2= =A0- zblock:
Zswap:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 234= 128 kB
Zswapped:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0733216 kB

-=C2=A0 zsmalloc:
Zswap:=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 286080 kB
Zswapped: =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0774688 kB

<snip>=
>> Since zswap is used starting from minute 21, this gives 9= % in average in
>> advantage for zblock.
>
<= /div>
> This might be the linker step swapping out source files that ar= e no
> longer needed. Do you have metrics for zswpout and zsw= pin as well?

I don't think so, the logs show t= hat the compilation is ongoing. Then again, we're just running out of RAM a= t that point.
Regarding the zswpin/zswpout, zswpin numbers ar= e marginal with the compilation test and zswpout numbers are slightly bigge= r for zsmalloc (average ~50k vs ~49k).

The num= bers for the stress-ng test (stress-ng --vm 4 --vm-bytes 8G --vm-keep --tim= eout 10m --metrics-brief) are roughly the same:

- zblock:=C2=A0zswpin 9870143 zswpout 10642176
- zsmalloc:= =C2=A0zswpin 10642941 zswpout 10432625

<snip><= br>
> My concern with this allocator, and the other alternatives = to zsmalloc
> before, is the following:
>=C2= =A0
> You might be faster at allocating objects. But if storage = density is
> worse, it means you have to zswap more pages to = meet the same incoming
> allocation demand. That means more o= bject allocations and more
> compression, and often a higher = rate of refaults and decompressions.

I underst= and. It looks like the storage density is comparable, and for 16K pages zbl= ock may even be doing a better job, see above.

~Vitaly

------------125718-1743810988579-2-- ------------125718-1743810988579-1--