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 9D22FC36010 for ; Tue, 8 Apr 2025 21:39:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2678E280032; Tue, 8 Apr 2025 17:39:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 214E9280030; Tue, 8 Apr 2025 17:39:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 103C4280032; Tue, 8 Apr 2025 17:39:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E8014280030 for ; Tue, 8 Apr 2025 17:39:03 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 624DA1A1638 for ; Tue, 8 Apr 2025 21:39:04 +0000 (UTC) X-FDA: 83312192208.21.4C4E3FB Received: from mailrelay4-3.pub.mailoutpod3-cph3.one.com (mailrelay4-3.pub.mailoutpod3-cph3.one.com [46.30.212.3]) by imf05.hostedemail.com (Postfix) with ESMTP id D679110000B for ; Tue, 8 Apr 2025 21:39:01 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=konsulko.se header.s=rsa1 header.b="UF6r02/x"; dkim=pass header.d=konsulko.se header.s=ed1 header.b=qQu0hJIs; spf=none (imf05.hostedemail.com: domain of vitaly.wool@konsulko.se has no SPF policy when checking 46.30.212.3) smtp.mailfrom=vitaly.wool@konsulko.se; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744148342; h=from:from:sender: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DFqccygusJ2q4mLsj0hmSnYNuPPTLeqNCbWp99vTaLk=; b=K5e1P73ZjfpJ1ghrewzwI9z2dD/LKU/lTsFC0r9N+hLx0SnGIV9T5HeFBlInwj8eO6jnmn 8Ko2dFlf9r4kwty7qPUn3qgXxEiTWpL5pSIZe8wNNatCQRccD0LInRs+GYH8pU0vWvkzm0 GhktwTJ2SbbP3FFpT3Xi9+I8uX42a0s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744148342; a=rsa-sha256; cv=none; b=xfhWbLpgnmI/bv1Q+hy6tt9EQn4Bcavnw07bI35PaGj9DoQcVvcY90dLD4BkvYAxcVmA6X sWdbtK/cCRAXi2jymYPIKnvOo782aj/gpvD/9kuKoCXk6zRMFiYRY8iR2yoh+qj947rUYF 1yqCZdo1tfS4h1OE/H7RSvtZmJ7uyuw= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=konsulko.se header.s=rsa1 header.b="UF6r02/x"; dkim=pass header.d=konsulko.se header.s=ed1 header.b=qQu0hJIs; spf=none (imf05.hostedemail.com: domain of vitaly.wool@konsulko.se has no SPF policy when checking 46.30.212.3) smtp.mailfrom=vitaly.wool@konsulko.se; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1744148338; x=1744753138; d=konsulko.se; s=rsa1; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=DFqccygusJ2q4mLsj0hmSnYNuPPTLeqNCbWp99vTaLk=; b=UF6r02/x+oopiIYU0+noriCI1xgsP2xMeHjUYwxk5lyHYSNooyitx4xlL8pJAOKSTLRiyN+lLG0bF Qe4UwfbwHhpXyA4r9uG7pxiKVjF5BRgn9Rsp7DTS3dNxmZrkWWHFEaR3Gw62r0vujWl9KmK9jTLR49 wx0hnlLVujFxhNTb5N+W07A0WQFS+VKd/EbKDUUBuiHt3W9/HUucJ90rpXSuAqhCE3YMciqMt2Nxsl 3y0CLweMgQdwnj/BwXp6qTeogwpY8jEO6pHFmvVyoLxNZqv8Mi7Vo9F3/jBvMIEY9/nYU4jBASMeh4 GMZnTUcpDCGDjnNUm8DHknUm2gkN2Tg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1744148338; x=1744753138; d=konsulko.se; s=ed1; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=DFqccygusJ2q4mLsj0hmSnYNuPPTLeqNCbWp99vTaLk=; b=qQu0hJIs4IgTLlFCRMMl40jlI7tFppi2Fv6+GR/5GU1y+SNUyHeF9P1GLuBRosqGQOvw7gotnKts/ F9hsC6gBg== X-HalOne-ID: e02a6414-14c1-11f0-93e8-29b2d794c87d Received: from [192.168.10.245] (host-90-233-218-222.mobileonline.telia.com [90.233.218.222]) by mailrelay4.pub.mailoutpod3-cph3.one.com (Halon) with ESMTPSA id e02a6414-14c1-11f0-93e8-29b2d794c87d; Tue, 08 Apr 2025 21:38:58 +0000 (UTC) Message-ID: <24e77aad-08ca-41c4-8e64-301fcc9370b1@konsulko.se> Date: Tue, 8 Apr 2025 23:38:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mm: add zblock allocator To: Johannes Weiner , Igor Belousov Cc: Nhat Pham , linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Shakeel Butt , Yosry Ahmed References: <1743810988579.7.125720@webmail-backend-production-7b88b644bb-5mmj8> <0dbbbe9d17ed489d4a7dbe12026fc6fd@beldev.am> <3f013184c80e254585b56c5f16b7e778@beldev.am> <20250408195533.GA99052@cmpxchg.org> Content-Language: en-US From: Vitaly Wool In-Reply-To: <20250408195533.GA99052@cmpxchg.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: fbu764pb6rubiq4w7tugmgqa7nakz9bh X-Rspam-User: X-Rspamd-Queue-Id: D679110000B X-Rspamd-Server: rspam08 X-HE-Tag: 1744148341-961572 X-HE-Meta: U2FsdGVkX18EkffULYOa1hVyXM0rgBk/ZYpANIDsb1jnJtm59AFR1Q8ULriApsUKFnKUDoMQBI4uYboFEplcGtSu4VM+wqVXeJJ9TCfN1be3wHuurd6SmQTykYqtSGHDxtnDyqslbeoPrHFh4IedTXAuXBpiCc+jntf22jhz4CJ6vSm0phGS7JRthPrraxlXZq2mutOH9pMEi4HwvYS6hibn49sN2kn+tlbDSxIxFap4FA9YKymstnX1CKnknh6dRr7q+cbjVqdaqJPmuF0p216afG1qjb8kLRASFR0G2QArLSSbXPQ9WjSe2VCmayKre2BakxB7CtnBzUuidEmo94DPyI9uQf9JCHKPoZ5V1Nh1wJA6UuopvU1XrfnobX1lxlPN85DW06UCYLalthOF4L5oH60WjH5G3RLXgwQHFx+PhmBBEF7GlmQtgLqgVYkZROuW2lDMvTzcv/MNZl8r32csu/uQmMw+5ysAa/hRPI6nuJWzfCspFP1KwE3iMDGfQWW9H76OyPiHduVEPAXoTw5ADMyFabxlzOn5arAvBwx4f1A/xwA7/kOqYWqYrYNQtwSV4b/mUtwlJdciDBnHVbb29y4MhdF2a0YjmRrtI4tRVkyX1ARPWbFIsQ3J5SB+1ih1wxYtjsrZzf0HqW/p/sl1WpdyArTyEqyn0J+8DUeOeVhbshAZCTLekA3ENJBj2sqrBfa6iZ2IwDZQwPGv8TM1FSRuqAKQdlGdie/cPrn3Msk5iwDm5AVgR9W7SjgN3Ucrf6Pe5gD+Mcu/mwJPY28J+2tlkwDoQY+FuU9JOZjbYcA14gPwyjEsu2WhYu6bJ4tRHnAIVI+XTLFJqvw3RMXrdl9cVoj/j+3CIWC3aNYmoiPlVvyBqR4eEAeRrKflDxlQLRWSqBrhpxa1yHJTi36cbtNtyYKnxj5+GUgiAmSqCvvXWTzb4cB8TcMWsNtZ6zdh4cRuXA1lwCUZsBX FJp7H2ZT 4w9NVeuLQWaUMyBY2Ox/IqgLGKqxosZtpcUhBpAzotZKpOPpN0zuNq5ig25gHNprsFZrNU/RJIDF8M6Q9t93zikngnb7ZYqYlWqJCL/sKrpia4Kza5fooLDu79tbNhP7vxYZORXmVGGtGKN5yggJ5bNsgO+KGJkjBQmxLken08J5sC1oF2/e+cIwOZlf8C1RkBfkJQi9FXZyWIGmQQafyP77LAqNeVoeoCLcYrEaOfhs9uyk= 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: On 4/8/25 21:55, Johannes Weiner wrote: > On Tue, Apr 08, 2025 at 01:20:11PM +0400, Igor Belousov wrote: >>>>>> Now what's funny is that when I tried to compare how 32 threaded build >>>>>> would behave on a 8-core VM I couldn't do it because it OOMs with >>>>>> zsmalloc as zswap backend. With zblock it doesn't, though, and the >>>>>> results are: >>>>>> real 12m14.012s >>>>>> user 39m37.777s >>>>>> sys 14m6.923s >>>>>> Zswap: 440148 kB >>>>>> Zswapped: 924452 kB >>>>>> zswpin 594812 >>>>>> zswpout 2802454 >>>>>> zswpwb 10878 >>>> >>>> It's LZ4 for all the test runs. >>> >>> Can you try zstd and let me know how it goes :) >> >> Sure. zstd/8 cores/make -j32: >> >> zsmalloc: >> real 7m36.413s >> user 38m0.481s >> sys 7m19.108s >> Zswap: 211028 kB >> Zswapped: 925904 kB >> zswpin 397851 >> zswpout 1625707 >> zswpwb 5126 >> >> zblock: >> real 7m55.009s >> user 39m23.147s >> sys 7m44.004s >> Zswap: 253068 kB >> Zswapped: 919956 kB >> zswpin 456843 >> zswpout 2058963 >> zswpwb 3921 > > So zstd results in nearly double the compression ratio, which in turn > cuts total execution time *almost in half*. > > The numbers speak for themselves. Compression efficiency >>> allocator > speed, because compression efficiency ultimately drives the continuous > *rate* at which allocations need to occur. You're trying to optimize a > constant coefficient at the expense of a higher-order one, which is a > losing proposition. Well, not really. This is an isolated use case with a. significant computing power under the hood b. relatively few cores c. relatively short test d. 4K pages If any of these isn't true, zblock dominates. !a => zstd is too slow !b => parallelization gives more effect !c => zsmalloc starts losing due to having to deal with internal fragmentation !d => compression efficiency of zblock is better. Even !d alone makes zblock a better choice for ARM64 based servers. ~Vitaly