Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp484267rwd; Wed, 7 Jun 2023 02:47:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uJAFxnCp+Y+jTzHB3B8yjCxQrHWl5o3eAY8j305Uah4oqamXCRMezGMY1BuCpWqPhtPuf X-Received: by 2002:aca:650d:0:b0:39a:ad7c:35a6 with SMTP id m13-20020aca650d000000b0039aad7c35a6mr4548073oim.56.1686131220927; Wed, 07 Jun 2023 02:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686131220; cv=none; d=google.com; s=arc-20160816; b=PsUmJ5TU9fmFH+I//RP+u8i9Mj68l52u187ilUJ+edRRriDLXb755BvGdc7WyUyNHH vXfsxmcL5JfbSBn/vI/6eWQawcsTtv7XFfvGRO2NqBUVERG3+QAB4So1tSgu+zaIqJ+N GSrBRSXyfCiikS75vNXM/iOvJmDt7UBAo9DRPhoivI89Q93//S02WfkpMEtADp4+1BYe wGMXCELti9lhe56eIOjZt3hN5Sm1jPaKb0jxh36bfBAHP/xIWcE1s0GwPQHhDwaC9Lx1 IZ6PsewsUv/fsQz6vZRcb9nLRndInD1+0qFzLq29agvn1WPXngn3e5xn6HooZbKirlZz 73HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZyGRpP0Ps5sjOMvaXnWUCGumxVowNckbi73GKWcFw6Y=; b=GhAU3UxSvRmffkLaP89A0K9lBNNLr0MR+gCFjeBnnWy5pRCCA1trmoU/abUhNkYjGa yBhS3kX1YmROrhAa5KVaj+lHgMWJgYMsTwknIeqYfTmt/32Cauw6kLSdBbP2mIhz1Tv5 eDfvF5WMhvdsQttUWB8/R5ZkhnWCZlf7Ul6svPaDrs2y81q9Xj5YOwfOsrPrwn+29ORi y9pfes17H+GDtjqCI2ilWQBV3gBlEGRoC+N4uLgIiN8Uh38zc2CthBnv2PaBM2HUkF+c 6lo1ENHr1QCf87+cB3wDodCV7OzaEJf9V8aiWEUBXbqYP3PlBFA/SRVa+WuFxOgOkJ9N 740Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=skpB9Y28; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a63690a000000b00543c84bf588si3756335pgc.473.2023.06.07.02.46.48; Wed, 07 Jun 2023 02:47:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=skpB9Y28; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240248AbjFGJd6 (ORCPT + 99 others); Wed, 7 Jun 2023 05:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240213AbjFGJdh (ORCPT ); Wed, 7 Jun 2023 05:33:37 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E7CB210B for ; Wed, 7 Jun 2023 02:33:14 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-514ab6cb529so795851a12.1 for ; Wed, 07 Jun 2023 02:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686130392; x=1688722392; 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=ZyGRpP0Ps5sjOMvaXnWUCGumxVowNckbi73GKWcFw6Y=; b=skpB9Y28QJwaQ1oYzJ9dVjFJKCA5DWClhZLKEJn6e1toC5Nx1srQ+9svYbYwTRrDb7 ym++/0S/g1UVOZvvhkcclhkrid52UBT/tvztyrUXS3HccpXPYeacBNJAurlzjc+0Krng vzVjjr67NCt+irsu+0Vyr62LdB4WKJ6Ii+DtPKOexemRiWwARUiyaw2Hr+z0CoEqTUw/ Q9VIOrX0nS+DYa6flie0KSv/peTtvfTjGt7GFVnNukS38IEuEiSamloosqnwhUWvXdxO cGdzZD69sAWSQDaYH57BZ623NlMpf8kKujiFnifqv4ib+meqNERAExTBxelLOv1dAKGD 8+gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686130392; x=1688722392; 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=ZyGRpP0Ps5sjOMvaXnWUCGumxVowNckbi73GKWcFw6Y=; b=Vjh7TfW5bNOfW9h6xHsPZvgC8pQL2oTsatyyIyMxZvKyC60BF06OlI0/n+0eH2MzVN G2ip5zBKHMWN9i/PxhtaBDjKdGrJiF3sOpZHAETMGPGrepmHxLzYoOWzw8+EdJ/gKcwg RGs8luQpSdCFzoUVdFyzOSG4Uw/0Gkc/Gh2l/A8CG9mvkPZ2/ns5dBF3Q7RvJXhwIGHE 139z92L/W95IKfiRT1U9HcpOtVZSDanapz90xfGAfZ+6b61iD+XZt4z2cRdUknvKn/Vc 4tu/umLJdLrhmawpLIxbdTS3bq6MbcxygNFfdk3M/mMUvX97qm7Xcy6SScJqHDCIfp8w 4t4w== X-Gm-Message-State: AC+VfDyvA3S0iWtbDgNWYdos8QTy6Q69LtzGRED6EQ1MtNsuOGtBkCCy bbe6Ty78MCJnEsVntxqN2SmXC+HuSvlzqVR78dym5COwYJt2c7KEUh8= X-Received: by 2002:a17:907:c28:b0:967:13a3:d82c with SMTP id ga40-20020a1709070c2800b0096713a3d82cmr13862639ejc.26.1686130392037; Wed, 07 Jun 2023 02:33:12 -0700 (PDT) MIME-Version: 1.0 References: <20230606145611.704392-1-cerasuolodomenico@gmail.com> In-Reply-To: From: Yosry Ahmed Date: Wed, 7 Jun 2023 02:32:35 -0700 Message-ID: Subject: Re: [RFC PATCH v2 0/7] mm: zswap: move writeback LRU from zpool to zswap To: Domenico Cerasuolo 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-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 7, 2023 at 2:24=E2=80=AFAM Domenico Cerasuolo wrote: > > 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 reorganizi= ng > > > the LRU management. In the current implementation, the LRU is maintai= ned > > > within each zpool driver, resulting in duplicated code across the thr= ee > > > drivers. The proposed change consists in moving the LRU management fr= om > > > 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 th= e > > > 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 submitt= ing the > new version. Perhaps give v2 a little bit more time to give other folks a chance to take a look as well, save yourself (and probably Andrew) the trouble of sending a new version for every single review :) > > > > > > > > > V2: > > > - fixed lru list init/del/del_init (Johannes) > > > - renamed pool.lock to lru_lock and added lock ordering comment (Yosr= y) > > > - 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 > > >