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 CFCBFC04A95 for ; Thu, 29 Sep 2022 06:56:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 387EA6B0074; Thu, 29 Sep 2022 02:56:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 337476B0075; Thu, 29 Sep 2022 02:56:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FEA78D0001; Thu, 29 Sep 2022 02:56:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 104056B0074 for ; Thu, 29 Sep 2022 02:56:01 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CDAF01C6C05 for ; Thu, 29 Sep 2022 06:56:00 +0000 (UTC) X-FDA: 79964213280.23.DC8B2F7 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf07.hostedemail.com (Postfix) with ESMTP id 768FD40004 for ; Thu, 29 Sep 2022 06:56:00 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id q15-20020a17090a304f00b002002ac83485so517249pjl.0 for ; Wed, 28 Sep 2022 23:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=Aq26zkQUDN/DAvNm1SA5nD0/d4CDDUzCQnDkmUfeUS4=; b=sGGy0rpO89Bx/aPU41DcGWf3Z1ves8s4hMCJ6qUcEN5A4OUhqAgVlW5Ks/X5G5AhcY B2u2/sFhXgNf5E8lLICNDcNBh5a9tIx6SLUlnrr5XuA0G6fSzfC2bE/bpPIxtlNhN0uK DFxiVjKvxtaTDfDTxEohm7xK9eU8ehvcm4Gmw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=Aq26zkQUDN/DAvNm1SA5nD0/d4CDDUzCQnDkmUfeUS4=; b=y8hJdzH0UJzEcAZhj206DX/F5Fc/Gn2rEmRzismXm5nb1rxZh9qcgt7m/HRhwoO8JH tBcsqWU3o4m5HHw71eQ3z7QvUJZ1G40IvPlUrFznQUbMdD1I348l29qJfQLcAL8IwUFp X1cdeF02YTSC3d9aVpYgQxNZ/8ulkg7nhYKmbTXzpLhKGigoms2cLCGoeXdWoCppuJM2 Vz48BR6bf+x7VRdIhNiiWpkfLFIkxSTcvMFeFdHoiJHwVYsj5IkqVUb+epPWGmbenKXX GWbbR5VOS1UfLOA/8ngYtrolLMlCih6vJex600usAYhhz/KyY06haZ1eTY9PzLx+5Vbd qV1Q== X-Gm-Message-State: ACrzQf1q1rjewv+8qO8JyMX4gxMxy0nPj8zx8UJxDdljS+H6btl7Akq6 ShICKsx9xUqnDz1DqRKpmPBjGEr9BjhAgWXrlNLEUit3TMw= X-Google-Smtp-Source: AMsMyM7U6fQcjKU8C0lqrqqEPnrAM9reZTf6JPzV0p7klavFEzsppIeRcrYR8DKgPIG8vdWQTYA3XEG/kQJVuH+6Q3A= X-Received: by 2002:a17:902:ec89:b0:178:3ea4:2960 with SMTP id x9-20020a170902ec8900b001783ea42960mr2030484plg.160.1664434559331; Wed, 28 Sep 2022 23:55:59 -0700 (PDT) MIME-Version: 1.0 References: <20220928080100.19134-1-a.badmaev@clicknet.pro> In-Reply-To: From: Vitaly Wool Date: Thu, 29 Sep 2022 08:55:48 +0200 Message-ID: Subject: Re: [PATCH v5] mm: add zblock - new allocator for use via zpool API To: Ananda Badmaev Cc: Yosry Ahmed , Linux-MM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664434560; 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=Aq26zkQUDN/DAvNm1SA5nD0/d4CDDUzCQnDkmUfeUS4=; b=Stvxm+mpK8Y3ZMOEwg61ZT53omctAOsxlfIuDkG1yFhl9ZPImSznz5V+Qn+/MJrWA0o+Zx zkhxSjl6ylJvUjg0yHrItTXfSmhMjGHknvxKGmIeMx/HeTcieG48LjLq9n2AoAOuhrMud+ goRFiHocN5GeCTa1dkgHoTlgjhA0X8Y= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=konsulko.com header.s=google header.b=sGGy0rpO; spf=pass (imf07.hostedemail.com: domain of vitaly.wool@konsulko.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=vitaly.wool@konsulko.com; dmarc=pass (policy=none) header.from=konsulko.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664434560; a=rsa-sha256; cv=none; b=BmscViil9d6okJbfREGB8SI09l2ryhGr/ZzHasnLs4ltBccXnB2k16tdDNItrRxrgn1SPU uL7EYMVusnNNHf3lXUPTdoZKmHsh8s+wqqd+6SI3Sh9r7sUp9+t3BgPZoGarV9i+3ATRcZ l4m3xOFDZ4Av0NHZvgAFXzGeRmOZj88= X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 768FD40004 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=konsulko.com header.s=google header.b=sGGy0rpO; spf=pass (imf07.hostedemail.com: domain of vitaly.wool@konsulko.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=vitaly.wool@konsulko.com; dmarc=pass (policy=none) header.from=konsulko.com X-Stat-Signature: 5a8bdh1ayqj1m4qc6hrtinbuy67x5wwm X-HE-Tag: 1664434560-429415 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: On Thu, Sep 29, 2022 at 7:25 AM Ananda Badmaev wro= te: > > 28.09.2022 21:37, Yosry Ahmed =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > On Wed, Sep 28, 2022 at 1:06 AM ananda wrote: > >> > >> From: Ananda > >> > >> Zblock stores integer number of compressed objects per zblock blo= ck. > >> These blocks consist of several physical pages (1/2/4/8) and are arran= ged > >> in linked lists. > >> The range from 0 to PAGE_SIZE is divided into the number of inter= vals > >> corresponding to the number of lists and each list only operates objec= ts > >> 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. > >> Blocks make it possible to densely arrange objects of various siz= es > >> resulting in low internal fragmentation. Also this allocator tries to = fill > >> incomplete blocks instead of adding new ones thus in many cases provid= ing > >> a compression ratio substantially higher than z3fold and 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. > >> > > > > It seems to me, and I can be wrong, that there is some overlap in > > design and goals between this zpool backend and zsmalloc. They both > > try to avoid internal fragmentation by avoiding the static slots used > > by zbud and z3fold, and instead pack compressed pages more > > dynamically. They both have some sort of concurrency handling > > (separate block lists in zblock vs. classes in zsmalloc). A key > > difference is that zsmalloc avoids higher order allocations (at least > > based on its docs), and instead allows compressed pages to span across > > 0-order page boundaries. > > You are right. > > > The key differences I see here (based on this commit message and > > zsmalloc docs) are: > > a) Blocks in zblock can consist of higher order pages. > > b) Compressed pages in zsmalloc can span page boundaries (I am > > assuming this isn't the case for zblock). > > > > It appears to me that if zblock has better performance than zsmalloc, > > it can be because pages in zblock are physically contiguous vs. the > > 0-order pages in zsmalloc (TLB misses, cache misses, etc). Is my > > assumption correct? > > > > Yes. > > > If yes, would it be better to implement those changes as some tunable > > extension to zsmalloc? It would make it easier if we have overall less > > zpool backends, and also easier for current users of zsmalloc to > > experiment with these changes. > > > > Sounds reasonable, but I'm afraid in this case zsmalloc code will become > overloaded also there might be problems with keeping zblock simplicity.