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 D40D7C4321E for ; Tue, 29 Nov 2022 13:31:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F91D6B0073; Tue, 29 Nov 2022 08:31:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A98A6B0074; Tue, 29 Nov 2022 08:31:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 498CA6B0075; Tue, 29 Nov 2022 08:31:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3B4D26B0073 for ; Tue, 29 Nov 2022 08:31:59 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A92CA1C672E for ; Tue, 29 Nov 2022 05:14:22 +0000 (UTC) X-FDA: 80185313964.17.EA8076C Received: from forward500o.mail.yandex.net (forward500o.mail.yandex.net [37.140.190.195]) by imf29.hostedemail.com (Postfix) with ESMTP id A2E78120016 for ; Tue, 29 Nov 2022 05:14:19 +0000 (UTC) Received: from sas8-838e1e461505.qloud-c.yandex.net (sas8-838e1e461505.qloud-c.yandex.net [IPv6:2a02:6b8:c1b:28d:0:640:838e:1e46]) by forward500o.mail.yandex.net (Yandex) with ESMTP id F355A9413D9; Tue, 29 Nov 2022 08:14:16 +0300 (MSK) Received: by sas8-838e1e461505.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id FEIkxX8eNeA1-lABiCWKy; Tue, 29 Nov 2022 08:14:16 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clicknet.pro; s=mail; t=1669698856; bh=Tfv6+KaKp2P0qBOuNiomfFbZaEecbRBnBxxMX4uq+20=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=f+udhDz3vIlFqQkPfNx9xuwjTSE2W9AgpTkMUD5syIbaQy9gUuFTmmbanMwp2KoZI /+ttUBguZ4ejyKjqT2q5wqU8zLdpYvnsQ1LTxmvS6VK0EkXONHwKtsRI/GEBl4UHCa sT6c+Lla/xHxL+21iSoYiiaKkEcV5SOh5fnnZwaA= Message-ID: <00cadf6a-85d7-128c-cead-4477c04e8e4c@clicknet.pro> Date: Tue, 29 Nov 2022 08:14:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v6] mm: add zblock - new allocator for use via zpool API To: Johannes Weiner Cc: linux-mm@kvack.org, vitaly.wool@konsulko.com References: <20221104085856.18745-1-a.badmaev@clicknet.pro> Content-Language: en-US From: Ananda Badmaev In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=clicknet.pro header.s=mail header.b=f+udhDz3; spf=pass (imf29.hostedemail.com: domain of a.badmaev@clicknet.pro designates 37.140.190.195 as permitted sender) smtp.mailfrom=a.badmaev@clicknet.pro; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669698860; a=rsa-sha256; cv=none; b=6xZF7FdqaRDrb+j+pv50zApwTBdsQ9t+r2g28TR1bFT5+XORP99Mm0pBuSM1UbMnluFmZB 6TXfmKH7xyGcGivS0Qdj9vQaepMGCvxsHDbX0R/oTXFhFBDGPoS1MCcRTnezRKroSg0o3T J4Y+FcRqXffdEfXq7jJ0EzlWrQpVuFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669698860; 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=Tfv6+KaKp2P0qBOuNiomfFbZaEecbRBnBxxMX4uq+20=; b=Da5wkj43pG6VBeAKfGWjeRYSTLrGgB3kZVA0RUfFdM2KusTxr9DYSF5MlwUu+xB0F4w6TH TRrIaHyLhbvdAshLlbWbwhc8kFnSTpaH3EMy1/NmmlcVKmdOETEgUrg4pNwcNJ9yK/AC16 s+Trjm2s8FHxuiwW6OJ4YOfme3THGcs= Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=clicknet.pro header.s=mail header.b=f+udhDz3; spf=pass (imf29.hostedemail.com: domain of a.badmaev@clicknet.pro designates 37.140.190.195 as permitted sender) smtp.mailfrom=a.badmaev@clicknet.pro; dmarc=none X-Rspamd-Server: rspam01 X-Stat-Signature: b7t6g1eo4e1y1cgb747ofydg9j1h87kt X-Rspamd-Queue-Id: A2E78120016 X-Rspam-User: X-HE-Tag: 1669698859-173174 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: 28.11.2022 23:01, Johannes Weiner пишет: > On Fri, Nov 04, 2022 at 11:58:56AM +0300, ananda wrote: >> From: Ananda >> >> Zblock stores integer number of compressed objects per zblock block. > > What does that mean? > The general idea is to store an integer number of compressed pages in a fixed-size storage unit. In case of zbud and z3fold single pages act as this storage unit. In zblock, storage units can consist of several pages (page order 0, 1, 2 or 3), but still their size is set at compile time and does not change further. >> These blocks consist of several physical pages (1/2/4/8) and are arranged >> in linked lists. >> The range from 0 to PAGE_SIZE is divided into the number of intervals >> corresponding to the number of lists and each list only operates objects >> of size from its interval. Thus the block lists are isolated from each >> other, which makes it possible to simultaneously perform actions with >> several objects from different lists. > > This was benchmarked not long ago in the context of zsmalloc, and it > didn't seem to matter too much in real world applications: > > https://lore.kernel.org/linux-mm/20221107213114.916231-1-nphamcs@gmail.com/ > > Do you have situations where this matters? > It seems that in real applications, compression ratio mainly matters. According to my estimates, speed of allocator operations does not particularly contribute to overall performance compared to compression time. >> Blocks make it 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 thus in many cases providing >> a compression ratio substantially higher than z3fold and zbud. > > How does it compare to zsmalloc? > In general case: Zsmalloc > zsblock > z3fold > zbud >> Zblock does not require MMU and also is superior to zsmalloc with >> regard to the worst execution times, thus allowing for better response time >> and real-time characteristics of the whole system. > > zsmalloc has depends on MMU, but which parts actually require it? It > has its own handle indirection and can migrate objects around and > replace backing pages without any virtual memory tricks. There is the > kmap stuff of course, because it supports highmem backing pages, but > that isn't relevant on NOMMU either. > > Also can you please elaborate on the worst execution time? > There is an opinion that use of zsmalloc can lead to an increase in response time. And zblock should have better real-time metrics. > My first impression is that this looks awfully close to zsmalloc, with > a couple fewer features and somewhat more static design choices. It's > in that sense reminiscent of the slob allocator, which we're in the > process of removing, because 3 slab allocators is a pain to > maintain. This would be the 4th zswap allocator, and it's not clear > that it's drastically outperforming or doing something that isn't > possible in one of the existing ones. Initially there was an attempt to combine advantages of zbud and zsmalloc to obtain a fairly simple and fast allocator but with a compression ratio closer to zsmalloc.