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 D4B0CC77B7A for ; Wed, 7 Jun 2023 09:24:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5EA036B0071; Wed, 7 Jun 2023 05:24:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 59AD9900003; Wed, 7 Jun 2023 05:24:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46241900002; Wed, 7 Jun 2023 05:24:10 -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 35D716B0071 for ; Wed, 7 Jun 2023 05:24:10 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 04F531A019D for ; Wed, 7 Jun 2023 09:24:09 +0000 (UTC) X-FDA: 80875415460.01.11DF21E Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf21.hostedemail.com (Postfix) with ESMTP id 3D01B1C0006 for ; Wed, 7 Jun 2023 09:24:07 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=JVvaPbMq; spf=pass (imf21.hostedemail.com: domain of cerasuolodomenico@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=cerasuolodomenico@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686129848; 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=QuG7FJt7+/guVeJ8/c8dvfJd5cbH1CGDk8/6AW8Yle8=; b=jkebatNkPKI7LEyiqNiz6WGqh0jy0RMMWPQBCL1eWe5kUffrhMnx/rH6ELNfo9WQF0E4N8 3BWZ0N25OBiuHLv2wpECsSvKdDr7XFVTLUXHyu+dNQhcXsTVY4uxc2xeScfRT6xXcW56a0 0fUM/MieXv70o6phwXe3jKtfUA/p7v4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=JVvaPbMq; spf=pass (imf21.hostedemail.com: domain of cerasuolodomenico@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=cerasuolodomenico@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686129848; a=rsa-sha256; cv=none; b=Yi4W8UiW81cby4FMznvABo726J1QgrVKFNrZYwnPjygSIBqfjlk+I13w3v4UaYEKpATTDC lKNZf7KvCqBnK+ki5dvQwO63JjhU5LyfpM/rwPqpqgZ/IVi54yTzH+Nf8UfwPZKdZVHn2K hf59efp1D8Qfcib/7LEbKTpZ4T96Yrk= Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6628041e8ddso13573b3a.0 for ; Wed, 07 Jun 2023 02:24:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686129847; x=1688721847; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QuG7FJt7+/guVeJ8/c8dvfJd5cbH1CGDk8/6AW8Yle8=; b=JVvaPbMqp4LAFR4QpYZzogKYRLoKfxK3tlP4kX9km/P7Amy4CSW20UV7Dtwlf/sFpA +h9sUjqyT0GGma2DBwq5HQ2EHVCMGdBN8opTBjST/w08+sCt9Q3ui4XIpCxgtUxO2kjn qWwzEXy4t+F5S9h0UnfTs3/RLsoYvyZwze+0IrgaP/RSHaSo/j8oZCppu69le3TdUBVW jw8ciSuGRJVnW1J2vSEuvt8i+yGO73LdiGwzmboc/HGv5Bk8X3ZnWIaBOYUyBujZnpfM +zWQIdj3nPBAxVCcO++FtOMThMO589mTvpmbPAvx/l7lQIUrrLsZ5Tv7xbDTePiTnp/y Zq5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686129847; x=1688721847; 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:message-id:reply-to; bh=QuG7FJt7+/guVeJ8/c8dvfJd5cbH1CGDk8/6AW8Yle8=; b=TCtPtpI/n99XDetmnYTvqryhreqk+z+fLeGeIevaZQSpqvO7ddjJgFdVZcFUtx8VsX ZtI+ghJlqE+fIkcH48tPGs+K8YzE88UlvHBqh2gNPx/1arhYFrAJKoECC0ZGrf2TDf5u is3GaSUMGQTTwTmO7iv+mDcAkbD7jEN06xQpbAh+XmQs9oAvsvgZGja218nIsiGHBNqr AKVeaR/3Ui21UnokigUw632dme16PI43RGXaTJO5M237ttb/d/Gxf1BhpFkpe5RlAxtK nk3Dx5eA4Z7deCileLjJRCd3P9DcYmDQHUpVDhcq6rRakIYs+Pkh/FV0bOeWC3UexieB f3sQ== X-Gm-Message-State: AC+VfDxCLWZkt8cf0n+VUIKT3SDrpNiaPJWuMEmBMauFtOy9+Ktx7zyb uIoDzho2RbXLLj5aUtG80LCwepxg7ugYP4o51po= X-Google-Smtp-Source: ACHHUZ6olcbywFiJ8o2+fYH6jVdA9wf81hv7Hxa6DgDi2MZmsm2OOwaCjynLV2r5U8nYY0yDoNYbtQCmV7yFbYBx+6U= X-Received: by 2002:a05:6a20:a110:b0:10b:4a5d:87e with SMTP id q16-20020a056a20a11000b0010b4a5d087emr762824pzk.53.1686129846787; Wed, 07 Jun 2023 02:24:06 -0700 (PDT) MIME-Version: 1.0 References: <20230606145611.704392-1-cerasuolodomenico@gmail.com> In-Reply-To: From: Domenico Cerasuolo Date: Wed, 7 Jun 2023 11:23:55 +0200 Message-ID: Subject: Re: [RFC PATCH v2 0/7] mm: zswap: move writeback LRU from zpool to zswap To: Yosry Ahmed Cc: vitaly.wool@konsulko.com, minchan@kernel.org, senozhatsky@chromium.org, linux-mm@kvack.org, ddstreet@ieee.org, sjenning@redhat.com, nphamcs@gmail.com, hannes@cmpxchg.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 3D01B1C0006 X-Rspam-User: X-Stat-Signature: ekm8qkigpn3eh9ctypsudyh6x4mers9x X-Rspamd-Server: rspam01 X-HE-Tag: 1686129847-83908 X-HE-Meta: U2FsdGVkX18uTLGodojdr9NXA/Ec8xmr1A2uVuiXonJWddkm9VAmutmAoWfFaDSoZkYKzlEBX6srz0PtUfNxqYYlL3XvIDXiXM96V9TvyGxlXChiH1EdVvh5TFS9GCe8GysifbcZ8SC01sX14K5aTCugwz++gdxUxqMCLTHsjBuHYNr8OKMTl1C+jnjLsRvcTi5xo8T5e360uPABrRoLfc9HT2R9OiDAReYXTo+7imiAvC3U9dpGccyKV1uvQgMIxCyhX1LM+nMorKQTGPb44OMb7gtd66BjKGQdpwkCfFlMFkbvxHldvzf2YFAu6kkFZjJ+u+TacFpIA1WobJBq9spO6SEz4amTlUdrd8sOPiIGTu5mLwOQDw8MC1JIQ59blbXum3g5vnUEkZuTWbE4bjINz+nS63bxk9cLeVA3+1NIm6AJ1anHk0nsOM+QofZqOb0SHFuHa5AyOxosFeZgZbDxyQRWbODu9yzSrPIy0/5QTXbHoUYJiGfCwjCpRchcEGCfYX7ZM6PR2I2mwSR9XORtQk9bvvAWcxh1drpDWkQAZ7K1fcJAptci8vJNByL53Flfsj4NDnyfZKit+IDcuLtzHZ07U+eh2ukwfiB1C/kuSPy/Bn1g67rZp/WHvM+G67/yV7pCKFyux3wXV9c0xoHNJnSTfKznZlfcNzDXjLoX5aEu3ghE+zi0y4atIvAkWY5BAzLtE7IeLZp/YWqmCAO5OcP4ZXj1McAJVKcBqYBsZmUf53ocU0KIEnnwUCsHFv3b+mpj17nFglaQ5m5QUoQjN3lExyDeUlrsNs9nLnbnNIZ+JoIaz4SwXmawAhzYvnbGnee+flGILy0/gYN/Rsn7CnP55VhObqtdPsm/Uh0PuMCxYuKtWkQu7GF/SMkcNDNo97B5CdgKQDy8vmCDMVqKmBirzJ8yeKOEG8T63p/whQByXCcs9pqUcwkgNwNIqDVttFad6xYE8tWyt5h KC1ql9yF P/YIGyYEaaXP1m19ujvgc8lun9XkySFuYLqwAN2N42Qo/SFZOOqs+HGnWf9EIgSekgz64l/YZOIaauIZydsYrgn7MJWzOtESE/5+Jzjzu/InYmrm8V0nOi13s3tzCyzi00/3U+2+HsibeQ6a0LB2JtheX6y6C11+tAtn7c7J06ZNI6pJEwsXRNO+qp1SrRh/Hw9mWaiSNz8YzqGUFVlimT9C2kuaPofO2C6XCn4awFbiQiW6eNGpVAfHVw9pqG00jC/VUJdu8hBUWCQVH+c9+YK04LEx63V7kwnt9r73IxSA9Ios/XJVDHEPX/ogUK6qZWB5es5MfaAxkx/fwD1rBdXpJxAFHSYE+JPeHKWiELkBkDY9C0v6Bd86sLubYubZz99sFiBXHW2Bd3Lf0WXe4T6Eo1g== 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 Wed, Jun 7, 2023 at 11:16=E2=80=AFAM Yosry Ahmed = wrote: > > On Tue, Jun 6, 2023 at 7:56=E2=80=AFAM Domenico Cerasuolo > wrote: > > > > This series aims to improve the zswap reclaim mechanism by reorganizing > > the LRU management. In the current implementation, the LRU is maintaine= d > > within each zpool driver, resulting in duplicated code across the three > > drivers. The proposed change consists in moving the LRU management from > > the individual implementations up to the zswap layer. > > > > The primary objective of this refactoring effort is to simplify the > > codebase. By unifying the reclaim loop and consolidating LRU handling > > within zswap, we can eliminate redundant code and improve > > maintainability. Additionally, this change enables the reclamation of > > stored pages in their actual LRU order. Presently, the zpool drivers > > link backing pages in an LRU, causing compressed pages with different > > LRU positions to be written back simultaneously. > > > > The series consists of several patches. The first patch implements the > > LRU and the reclaim loop in zswap, but it is not used yet because all > > three driver implementations are marked as zpool_evictable. > > The following three commits modify each zpool driver to be not > > zpool_evictable, allowing the use of the reclaim loop in zswap. > > As the drivers removed their shrink functions, the zpool interface is > > then trimmed by removing zpool_evictable, zpool_ops, and zpool_shrink. > > Finally, the code in zswap is further cleaned up by simplifying the > > writeback function and removing the now unnecessary zswap_header. > > > > Based on mm-stable + commit 399ab221f3ff > > ("mm: zswap: shrink until can accept") currently in mm-unstable. > > I tested this + commit fe1d1f7d0fb5 ("mm: zswap: support exclusive > loads") currently in mm-unstable, using zsmalloc and > CONFIG_ZSWAP_EXCLUSIVE_LOADS=3Dy. I only ran basic zswap tests with > manual writeback induction and made sure everything is sane. I > obviously hope you did more involved testing :) > > The only problem I came across is the conflict with fe1d1f7d0fb5, and > I suggested the fix in patch 1. With the fix, everything seems > correct. > > So I guess, FWIW for all the patches except 2 & 3 (for zbud and z3fold): > Tested-by: Yosry Ahmed Thanks a lot for the effort! I'll rebase and test it again before submittin= g the new version. > > > > > V2: > > - fixed lru list init/del/del_init (Johannes) > > - renamed pool.lock to lru_lock and added lock ordering comment (Yosry) > > - trimmed zsmalloc even more (Johannes | Nhat) > > - moved ref drop out of writeback function (Johannes) > > > > Domenico Cerasuolo (7): > > mm: zswap: add pool shrinking mechanism > > mm: zswap: remove page reclaim logic from zbud > > mm: zswap: remove page reclaim logic from z3fold > > mm: zswap: remove page reclaim logic from zsmalloc > > mm: zswap: remove shrink from zpool interface > > mm: zswap: simplify writeback function > > mm: zswap: remove zswap_header > > > > include/linux/zpool.h | 19 +- > > mm/z3fold.c | 249 +------------------------- > > mm/zbud.c | 167 +----------------- > > mm/zpool.c | 48 +---- > > mm/zsmalloc.c | 396 ++---------------------------------------- > > mm/zswap.c | 186 +++++++++++--------- > > 6 files changed, 130 insertions(+), 935 deletions(-) > > > > -- > > 2.34.1 > >