Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp485385rwd; Wed, 7 Jun 2023 02:48:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7EibgwkMLnuNJ6378zZKNGTMI+NKxmgEwvt3lv09BxCVmink7bxtBMEfzMIfV/m7ZiBQaQ X-Received: by 2002:a17:902:e5c6:b0:1b0:5ce9:adc7 with SMTP id u6-20020a170902e5c600b001b05ce9adc7mr15353696plf.28.1686131294533; Wed, 07 Jun 2023 02:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686131294; cv=none; d=google.com; s=arc-20160816; b=KAsMWAC2C6TgwXdijCblk2JZtPBejcx4sIH8jBwekVB9zw+rgnQGGiCLPS4uQ5KHhk HHG5xmXSwRTu4L2r3RnkXbTfCMSL/Dds9q7opmy0LXxRvozGPiiQMCKL0qp+zk6U6dRv YQutnAL6IsbSxkEbrWW2megXU7PeBhjrqU6Kdq6bA/14ZlUC4y8ilQj6kQNVhzq1VeK2 Q3CwtLTffe641sr9DMuUOhYVG8A4wQboBJ8dnIgIOCzYpAK8u52umXMWgqsQsrcu4dQx CfMFpjt1E3aM+BbGukhu0wu46mr6Idic3RUgWooYkNLqcbUHZTP0HMUuIfKuIJcAoGJH oNFg== 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=4TMhQ/p0kQE3tBKbaiCedT5vjfwFpJ54BprM1KGdd6w=; b=GM/Bs5rdCDEM66E6NUrt7QZMAn/wveaqzx9dfEqNWsYMmvdBti1jwzgr5iwk1QaiJX 9lny0uXLCVrqYuFGkfjl5t42GYxjiUsL28w+LhtXsmiyJnS9Xj8GWUfFrFFvECyHu5qp ZG1G/244KnRRCOLkm34e1EJFmK69VHt5dRKEl4zjk6qCnOBZo6A6o+HxYfagpJRynhHP rl9QjK6C9Uz1fPjU7LLG0jPZG5/7eWVXcR68qIz4wiZVxpuvElveuZFVeEIeMSnPIYKV 1Lo6EQQhFo6QOqfDl1/HSND/HyaqxpR+LIdve3ne8rAjMEINLjo6yzPxTYmK+3KUKX5J d9vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=p4ULbLJG; 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 h16-20020a17090acf1000b0025355f85165si867806pju.139.2023.06.07.02.48.01; Wed, 07 Jun 2023 02:48:14 -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=p4ULbLJG; 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 S239867AbjFGJXY (ORCPT + 99 others); Wed, 7 Jun 2023 05:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239673AbjFGJXS (ORCPT ); Wed, 7 Jun 2023 05:23:18 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8B581731 for ; Wed, 7 Jun 2023 02:23:09 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b1c5a6129eso43145131fa.2 for ; Wed, 07 Jun 2023 02:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686129788; x=1688721788; 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=4TMhQ/p0kQE3tBKbaiCedT5vjfwFpJ54BprM1KGdd6w=; b=p4ULbLJGXZBAaOZK0w/TjZvKvCaeykMkmTu2Gb2/Ey4bmnzn8H4GS0lteNLmwBX1xb 4E/kFbwJ7j5wiaLMvDsIuLNaSm1UfOeGCXoaffzV4a/J6HN5kIZo2CGYsfJKZ2OSpHvq WFBtGvelO4+IvobP3yKi9Y3g6kvWDGVI4RU1wT0KKTpfY3Q0xKqrbKrIq9m83TpE3tFW Hg7+p40jpYFVVXE2NaU9jKF7ovf/a0e1gxKC6i1cYrfTsKgXM6CzZACXHZKbjCMb/N47 F8aSQ0Gdx0jQVSuNbwfD8r/GVuRZ+UwVempUsJTXzTjaHkYjoiL/+hPw+kVZoQ9CM2lu B6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686129788; x=1688721788; 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=4TMhQ/p0kQE3tBKbaiCedT5vjfwFpJ54BprM1KGdd6w=; b=Gqefs7Hs8l3sFkEU4xGiUU9qgFJETemr9zveHpqjZcsx3VUhLv6IsdkZDqpNZo63uK ClQ4OTXZ5Z1H5vSKD/Hzdu/pFqERQux4YVNLDpm0VdDlm8rJPKrUFimAVIng4OHcSs7y oNsLtk0+p9bpLJgHTiQJfWtr38aJ2Y+dTD5hWnIJS/w6sx7tM+IcFEWdVBfgeiAgXMfp X+lXnLBJ89EVz3bW6d2Ukqvn+4LptTkwXDJEVbYbZqEgBCR1jLoKpFwiGpQDIk99ZNhU Dd5bGpUpkMz1UpDpa2nKm76obOows59O+7n0id9SikEvpTB+iiP4MrVIrvBk2hFhzKa6 dbhA== X-Gm-Message-State: AC+VfDxJCuQAy0G7nQ5L5iWoW/WqrcnPPc9tEP0pHOSAp+so17lsprLk Rv6DaOWRTWxzP6lW0hpp5EXtBld3u9+dnWvWERnJJofih5hLvBp7k6gw3w== X-Received: by 2002:a17:907:ea5:b0:96f:d780:5734 with SMTP id ho37-20020a1709070ea500b0096fd7805734mr5573691ejc.65.1686129406516; Wed, 07 Jun 2023 02:16:46 -0700 (PDT) MIME-Version: 1.0 References: <20230606145611.704392-1-cerasuolodomenico@gmail.com> In-Reply-To: <20230606145611.704392-1-cerasuolodomenico@gmail.com> From: Yosry Ahmed Date: Wed, 7 Jun 2023 02:16:10 -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 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 maintained > 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 > > 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 >