Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1968957rdb; Thu, 7 Dec 2023 14:11:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4xpyRyDGkokuMTkgxC1tWSumPX1OjNZplNobcDM0VsRaN2ozUIbe94LBpVExzTU3ofiiY X-Received: by 2002:a17:90b:357:b0:286:a454:6b43 with SMTP id fh23-20020a17090b035700b00286a4546b43mr3344540pjb.18.1701987111685; Thu, 07 Dec 2023 14:11:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701987111; cv=none; d=google.com; s=arc-20160816; b=YLilpwQklsnTKufGpoccqSeiHGSPvGp7eQMtEIYLnG07vPf9RoM534zc0NbyjEOgm4 IcOA5Adnx/t5ryHjO2fgRMnBEreWGamNniJLqerCxWFtzCb6Dp1AtmUdxbryKJR1tMG1 UA7pdsas4Dj6fMadd+Ivuh1TAXC+DSsnF/o9e83G6yNbh/zjwI0y6CNkytYaYowv7xtR d8LFuQPaqoczvY/YZTA/dO4yZnOk9g9f2VmvE1PR+ATrtg+YJ0/Y54wkN7qZ3pfo3tVm uZI574mQ5XVf5tpMundEAuEsCH4gZ9I25iT66JEQp4YXtEp7oZEMB2uD2xL9mJM2rcOp ABEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=he2OLnHhm9fYhtMTKd7MLARqNMmy+PBFtc+XNp9rWc8=; fh=vMDBSbtyljwyQvQA3BaA46E8RH++M/D7OzCuTFMCT8w=; b=ckf3glvRIE0I9FLhsd2KAey/efSQo39etRuYiViL2q3wgxWQ1S8xjNxclTbJ0hxi7T mnLFXoGAZNc9Xv/Y/mNBYxWu5jQRv5WPggoyPvuqt/G+b5l8FMwa3NECr2DMbdos+aHZ F4kyI5SsBoLSx13SzN90sy4Wd1kBp8BSD+r7hPJ/SGX45DDKNXhFEPq/bgbZDOPr7+FK oR46yvKXP3y3zLrRQz6LrBKZp0GvUhMiI2gDcySxMYs/q9Dq5Xvfce6tx1RuhLTkcNxS RNQiQdcAPTY8to9e+WymhCiaq/lpVyl9dIE60c6/FUgczwkbcZSpiVhkAvNR1mJZSdcf M5Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=mMYBqqBu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ie3-20020a17090b400300b002850d5f8ab3si1778886pjb.174.2023.12.07.14.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 14:11:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=mMYBqqBu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 50FEB80CF533; Thu, 7 Dec 2023 14:11:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232144AbjLGWLj (ORCPT + 99 others); Thu, 7 Dec 2023 17:11:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbjLGWLi (ORCPT ); Thu, 7 Dec 2023 17:11:38 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABDA98 for ; Thu, 7 Dec 2023 14:11:44 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7796BC433C8; Thu, 7 Dec 2023 22:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1701987104; bh=gtl71HBKJQxQ32Agrxutqbcus3/RTRAhRHa92m2vZ9s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mMYBqqBusjscmfbCqYwr4KmHVQk204C5IArYBZMGpgLsQbnnrUSV6nZeLW8KKwvIW eRZoP2bJN/HWrDIrvSYUtPw3wmtfLHSPu3QhWxw5GDWQc8gdkd/MmQI2f6TbqT59QV fh8BxwFhgNhu68GfmwE9USNL+fAMcGOQNdULY3Hs= Date: Thu, 7 Dec 2023 14:11:42 -0800 From: Andrew Morton To: Nhat Pham Cc: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, cerasuolodomenico@gmail.com, yosryahmed@google.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 Subject: Re: [PATCH v6] zswap: memcontrol: implement zswap writeback disabling Message-Id: <20231207141142.307745be167d044b0eec1b42@linux-foundation.org> In-Reply-To: <20231207192406.3809579-1-nphamcs@gmail.com> References: <20231207192406.3809579-1-nphamcs@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 14:11:50 -0800 (PST) On Thu, 7 Dec 2023 11:24:06 -0800 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.com/ > > as it also disables the zswap shrinker, a major source of zswap > writebacks. > > ... > > --- a/Documentation/admin-guide/mm/zswap.rst > +++ b/Documentation/admin-guide/mm/zswap.rst > @@ -153,6 +153,12 @@ attribute, e. g.:: > > Setting this parameter to 100 will disable the hysteresis. > > +Some users cannot tolerate the swapping that comes with zswap store failures > +and zswap writebacks. Swapping can be disabled entirely (without disabling > +zswap itself) on a cgroup-basis as follows: > + > + echo 0 > /sys/fs/cgroup//memory.zswap.writeback > + This does seem to be getting down into the weeds. How would a user know (or even suspect) that these things are happening to them? Perhaps it would be helpful to tell people where to go look to determine this. Also, it would be quite helpful of the changelog were to give us some idea of how important this tunable is. What sort of throughput differences might it cause and under what circumstances?