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 36E2FC369BD for ; Wed, 16 Apr 2025 12:09:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E16F6B027C; Wed, 16 Apr 2025 08:09:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76C9E6B027D; Wed, 16 Apr 2025 08:09:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E2566B027E; Wed, 16 Apr 2025 08:09:20 -0400 (EDT) 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 3B89E6B027C for ; Wed, 16 Apr 2025 08:09:20 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F37D55B458 for ; Wed, 16 Apr 2025 12:09:20 +0000 (UTC) X-FDA: 83339786880.14.8257508 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by imf28.hostedemail.com (Postfix) with ESMTP id CA250C0005 for ; Wed, 16 Apr 2025 12:09:18 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b="x/dF/A9z"; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.181 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744805359; a=rsa-sha256; cv=none; b=R3Ri51hLBu6D/1S4pOZ/Np+x87CquSimWpXixcFRnuMk0typXlxft/kpA+kJwBYJAOxw39 Slm54gt5Ciwm3Iovq/Ikz5mTJE9NvYJrAO0FWgpswFqLbcmxhlCLsbGm9mg3Yjbg9n4tzb PMe3uYI2T2KJMJNzWBlV5+SkdodF5dc= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b="x/dF/A9z"; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.181 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744805359; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w1olKEULH3TLy8R5wbLrrPNwtY1HPqywCtfc8xVQ228=; b=PJunP50FN3nfSdSp5Fh9ubmH58xQzwnZHHCyv/+FssatBBVCjUqNWWlfZWzrRc8OkdWBIb 0ELkoYe4vTvKTUsrhKQzQXeUfm/7tYU/zk6Ag4ySOFtU/pXKlRTqrSPK41WqnHZsDxSGCp 2GJwErLnHVdHWCNKTcw0/Z5edoFrKtI= Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-476a304a8edso64088721cf.3 for ; Wed, 16 Apr 2025 05:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1744805358; x=1745410158; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=w1olKEULH3TLy8R5wbLrrPNwtY1HPqywCtfc8xVQ228=; b=x/dF/A9zPfzL7qxLgwQQEv/D3WbLMs5OstbTNlvybMzukrmNPkEVvB5drR40J/PNsN hasJo1GsD4Xms8HF39bM7frZIVRzL9ZgWnBBsuSci9lEYY03WzHHeMPu3GyYZYFip36S //n7HTo6Sa/nne5iJEXFfnoMh++v4jHC5YUk5iPjKwYUmIqtpyIRtAo5bMaWM9Ej6dHy D579Vcvl/nSScxmIPNWDOBMFP3LY7umMyCh+V4hKYMV3hURFwc5AH9sqW8redBGfuDEc A8cG6P+0FKB1UMc0gqDplinJlzvqMiYvH0LLWrqnFp+EFFBnhILx9/2887xRFGOBxhqn /tSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744805358; x=1745410158; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=w1olKEULH3TLy8R5wbLrrPNwtY1HPqywCtfc8xVQ228=; b=VauWEPkY2rANFJx3B8fCVZp2PDdJvYW7wKQbw6IqQv7V9+uYlT2migwEiIoJjogOCC n9Azvzvdh/hhGzcLUUIdrt/HgHpxd4FOXAFItVJMP3qv5FYLCNjtyUfBDhd4nxoq+s/L cqBdtH0slSHafxdYegWFxhDQNlHLiM78UnYcUhePHWY/j+Drk+Z9zCclBgZxtpvnkYfv nPlpnWx6dG0HpNmxtSo3C/7AYE54JL8vn8xWLfTujWq20p8ZSpUUOzlJsabb95XOosOZ 4gr09fCQFHViljpTdHU1U1+qtdyt3O0z+/KXWvCupvbErsv8RMkHVPI/hQhxjeuy4gVm ZYKw== X-Gm-Message-State: AOJu0Yx97iQ0Z8UHb65e2QEq1Pd4eqMDRm9Z4+0UjOGX9DvnK0j8C2kV heVDN73sPjaLHTj6tL9chdVW82REyvh9Rwoz6TSn1DyO3QxkVhZwhToGGgt0Aik= X-Gm-Gg: ASbGncvHKmKB1MbYLSmYYUjZfSxXioI9ydaXvBRrPQQRxpqPA76UcaWok1S1zgawJQM NeQY5wt9y8VHLpfPN42rxVzP3EgE2gRX6xVefo4pqb68HR+chRR/MXIyYRrb0kwCqc0ka5J59vI p0E0pF9Cgs0r35Qyb0L3E716D5OqmO2FJVCFeWgKEDW/Tz+PveEv9JmlYubavCMjTF1UOzPZwjU g2WM4EKANW51hu9Lnq4HzAnP1mpOsCXGlgFigQRkiwJFeAoH1InbOv2gi7ILj6lHDS/FydL/7eq ODlExO2beKsxAdcGcWeME/vrbv8NVf2L3OOmqEs= X-Google-Smtp-Source: AGHT+IF+gigl59GNjmhrqIV00i6oQSPe5kBPMIghLrWW++oW9RPjrNgCG4rFzudnQ0ovyUGjj3eDCw== X-Received: by 2002:ac8:580c:0:b0:477:64dd:575b with SMTP id d75a77b69052e-47ad8131a95mr18061491cf.45.1744805357803; Wed, 16 Apr 2025 05:09:17 -0700 (PDT) Received: from localhost ([2603:7000:c01:2716:365a:60ff:fe62:ff29]) by smtp.gmail.com with UTF8SMTPSA id d75a77b69052e-4797a21aae7sm88641051cf.16.2025.04.16.05.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 05:09:16 -0700 (PDT) Date: Wed, 16 Apr 2025 08:09:12 -0400 From: Johannes Weiner To: Vitaly Wool Cc: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Nhat Pham , Shakeel Butt , Igor Belousov Subject: Re: [PATCH v4] mm: add zblock allocator Message-ID: <20250416120912.GC741145@cmpxchg.org> References: <20250412154207.2152667-1-vitaly.wool@konsulko.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250412154207.2152667-1-vitaly.wool@konsulko.se> X-Rspamd-Queue-Id: CA250C0005 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: ams1ixwrei6dtx81omoz8rgq41fopmdq X-HE-Tag: 1744805358-458869 X-HE-Meta: U2FsdGVkX1+BQ8e9ggde8pXvLIK8kJuVhqJ2dH1wCTWluUmgGpwpUE9Fp1E2TZ7DtvpuVxaPjWr1h1ZWCRk+2oGlA1RPz+2jLozdR2F4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6HkB42FsM7DsjjaSDgvLvKxJaMw2RndqpURVEgmBY79wDNp9NWX/zbtv2wOLP24Prbt1Svl6i1oeXm8OPu3ZNttwaRSK75f00RVNy09nsUY+dEgUBTWRsdhyMs8XbHUxqiQTwqhnf+nezQjb3w0OqmTAt8kdFLdk0wt6wi1Toj8A5y2tyELyeWwFdul2HTQwog9khAi03ldLB5+EmPkD3m6ln8+28asf9f+Gs6Sjq+Mpm3bh7XSxyppXNSb/Fpcbdyu+YBswLit6g9PrXsiL1zo7Gm0AMpBjtQy34s7fCARpZEDew== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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 Sat, Apr 12, 2025 at 05:42:07PM +0200, Vitaly Wool wrote: > zblock is a special purpose allocator for storing compressed pages. > It stores integer number of same size 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 comparable to zmalloc's. > > zblock is also in most cases superior to zsmalloc with regard to > average performance and worst execution times, thus allowing for better > response time and real-time characteristics of the whole system. Is there a reason not to use this allocation scheme in zsmalloc then? I'm curious what others think, but I'm still not convinced a second allocator makes sense. It's maintenance overhead, a permanent struggle to match feature parity, and it fragments development and testing base. Not long ago several slab allocators were removed for those reasons. Likewise, we just deleted zbud and z3fold because they didn't get any attention and bitrotted, but not before years of inflicting pain through the zpool interface, users accidentally making very suboptimal choices, reporting the same bugs over and over again etc. If you discovered a better allocation scheme, that's excellent. But I don't see why it warrants forking the entire allocator. I also don't buy the fragmentation argument. Even if you are better at packing during allocation time (although, citation needed), the workload can unmap swap pages such that they leave partial blocks behind indefinitely if you don't have block compaction. Then there is the migration support, which you said is planned, but which would presumably require the same indirection between handle and the backing pages that zsmalloc has. How much will this eat into the performance advantage? I'd much rather you'd focus on making zsmalloc better. Improve the packing scheme, make expensive features optional/configurable etc. That would be easier on developers and users alike.