Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1889661rdb; Thu, 7 Dec 2023 11:27:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEM2GsEkdlnsK/isauOI4LsmHmuyd9HK7lSqwZslwxayTV8hB7MUBfG0LiRe5w3KnNnVq0e X-Received: by 2002:a17:90b:1b44:b0:285:a426:5913 with SMTP id nv4-20020a17090b1b4400b00285a4265913mr2442757pjb.41.1701977278479; Thu, 07 Dec 2023 11:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701977278; cv=none; d=google.com; s=arc-20160816; b=iPlKy4dnxQ+K/KSMzE6EyXL3uhK/lFoh5o3zIcA0CQJnPoa+D5Qj+V9wjBWldAAJyI NR2s+0iQrpOVdKCv6UvHuD5CHRWUVXE2TkctLGzYpp/FxEuWqZwgaKGiEUEei6foCRRd 7arg5/Ymo8YwGusBaVas62pn7kO4KQnsHsg3I8GBNLzXZbHfv9fM9u/h7089ZQeUCHfA 1kOkHQQnLb6s/mPY5rYAv8fRFCVYaeha3XPyr/AKglXlnHRYvM5RbZz9KP7o88qdXkMC ieMQFDPhVsKjWW256VRiVG8wLEuRvvePgdpuiS7yg+2mQq5L6uV2v+3uIYVPxFP6ZPhe siHg== 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=4E9EjufK+QQ1AdYRrvjoO8aPYSHXzTiO3F6OND42SLI=; fh=eOk0Aa4gls7jDwiZQpnTEB/F5oAr/CJFEt/TBesFPc4=; b=O0N2VQOWjrTw3o5130IZXNW3hSOg5WFYdCkUikEo6cWSB40XTjlnGENVfzXAyOpU3a oeGQ7ht3gGw2R73Tdvb1OS8EM6ISJqXpOtdxnlPsAfh+CnW7jnJIUK5D6ERlYNNgc/nY OT7a0osthfLZFaevRMT0RAoTpRn6QE6LxH6KaA1GaVFMTDGd7xTAQ3jgF3pkWXDYs3eG hHu0rfJzHFj9vPtdM5Qo59cBDXSso7biiu2tjMy80XZe/tunQ4riqG+8vyYO9eiWludh zjdmm7IZynD4dm6VcVbb2N73EhWaF4VwMgV8BmA+9/F/uTVmWchaScrQfa/bvkOViytL CGCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="I4/KHkK0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p11-20020a17090ad30b00b002887c0800desi303093pju.68.2023.12.07.11.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 11:27:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="I4/KHkK0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 939C480BD4E1; Thu, 7 Dec 2023 11:27:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233026AbjLGT1f (ORCPT + 99 others); Thu, 7 Dec 2023 14:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjLGT1f (ORCPT ); Thu, 7 Dec 2023 14:27:35 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4723C10DC for ; Thu, 7 Dec 2023 11:27:41 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a1f47f91fc0so95375966b.0 for ; Thu, 07 Dec 2023 11:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701977260; x=1702582060; darn=vger.kernel.org; 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=4E9EjufK+QQ1AdYRrvjoO8aPYSHXzTiO3F6OND42SLI=; b=I4/KHkK08+OWS1hN5mtQXof/bTMhQfAsjhynUtzwXGLjBWvHLiqw9pZrXxXLNK0QIi Sxkd3eU1r3A0TWcCpC4GlctsK1i35sJGNTSpeIwxjtcXULFUSRk1QJCJOO7UcK9n2VQS ESfmBVAwC8M8JXcAzUyx/ETJEvia0p3AfOIf6wpz7g2I1ih1VdG316yHrnhGhGYo3IE9 VkqVDPYGZfsp1Fqz307UuNx6X3oRX/0UYhCpuhoArxT8fJ6/o79scRUEV/C2C6Zl98FK 2NJt40hB9/ZmZs6//8L5163JekFUUcGLzqoQYNx1vWBCpM266/ZM5Bn5FuS8Ybua60Xt h4yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701977260; x=1702582060; 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=4E9EjufK+QQ1AdYRrvjoO8aPYSHXzTiO3F6OND42SLI=; b=UHDO1KV2w7FuJC2lcEzT+SIzJzROc5HG7UW+Am0M3PRcr/TvjLSLUxd2M1wp8tlSWI XKQWPCC6mS+o08Y71ML1M91JElqfTtCb0yDzoZyRWM87tDhTp4gwno6sgx3xNGLkAMPF TQ5tiF4lapdZQpuNkl9S6YszC+ELF47aUohogBEAHrXBuXRcwzLToSjBgngKikQh5NOP k1NOC0FUtcANQ46lhH1yPJY3P40loQTtS6yxUlIbZhjHP34pPqWisDi/R+7EHTf7L4aO ly7tf9mUL/FDlPmTaBPFPlW8IdbjxoFuFshNgGbs5KQ00XuRUu05Jjs2pVV4skcvhaOk y2MA== X-Gm-Message-State: AOJu0YwDK3gnFcKAtq+CWS2sUop92nGHvoURAV60krqnkWnkqn9RxSXw gT1IWH1v6LKOFUuRI8h8leC1Mc9egFt8brRkQ3nUNQ== X-Received: by 2002:a17:906:4717:b0:a19:a19b:5604 with SMTP id y23-20020a170906471700b00a19a19b5604mr1751313ejq.148.1701977259361; Thu, 07 Dec 2023 11:27:39 -0800 (PST) MIME-Version: 1.0 References: <20231207192406.3809579-1-nphamcs@gmail.com> In-Reply-To: <20231207192406.3809579-1-nphamcs@gmail.com> From: Yosry Ahmed Date: Thu, 7 Dec 2023 11:26:58 -0800 Message-ID: Subject: Re: [PATCH v6] zswap: memcontrol: implement zswap writeback disabling To: Nhat Pham Cc: akpm@linux-foundation.org, tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, cerasuolodomenico@gmail.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, hughd@google.com, corbet@lwn.net, konrad.wilk@oracle.com, senozhatsky@chromium.org, rppt@kernel.org, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, david@ixit.cz, chrisl@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 07 Dec 2023 11:27:54 -0800 (PST) On Thu, Dec 7, 2023 at 11:24=E2=80=AFAM Nhat Pham wrote= : > > During our experiment with zswap, we sometimes observe swap IOs due to > occasional zswap store failures and writebacks-to-swap. These swapping > IOs prevent many users who cannot tolerate swapping from adopting zswap > to save memory and improve performance where possible. > > This patch adds the option to disable this behavior entirely: do not > writeback to backing swapping device when a zswap store attempt fail, > and do not write pages in the zswap pool back to the backing swap > device (both when the pool is full, and when the new zswap shrinker is > called). > > This new behavior can be opted-in/out on a per-cgroup basis via a new > cgroup file. By default, writebacks to swap device is enabled, which is > the previous behavior. Initially, writeback is enabled for the root > cgroup, and a newly created cgroup will inherit the current setting of > its parent. > > Note that this is subtly different from setting memory.swap.max to 0, as > it still allows for pages to be stored in the zswap pool (which itself > consumes swap space in its current form). > > This patch should be applied on top of the zswap shrinker series: > > https://lore.kernel.org/linux-mm/20231130194023.4102148-1-nphamcs@gmail.c= om/ > > as it also disables the zswap shrinker, a major source of zswap > writebacks. > > Suggested-by: Johannes Weiner > Signed-off-by: Nhat Pham > Reviewed-by: Yosry Ahmed FTR I still prefer a more generic and future-proof interface (e.g. memory.swap.tiers), but I am not opposed to this. It will just be annoying to have different interfaces with overlapping functionalities in the future if/when the need for a generic interface arises.