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 EA108C10DCE for ; Thu, 7 Dec 2023 22:11:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A0186B0087; Thu, 7 Dec 2023 17:11:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74E656B00FC; Thu, 7 Dec 2023 17:11:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6182C6B00FD; Thu, 7 Dec 2023 17:11:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4E5A26B0087 for ; Thu, 7 Dec 2023 17:11:50 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2A66F1C082F for ; Thu, 7 Dec 2023 22:11:50 +0000 (UTC) X-FDA: 81541420380.22.B478EFD Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf26.hostedemail.com (Postfix) with ESMTP id BB902140024 for ; Thu, 7 Dec 2023 22:11:47 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=mMYBqqBu; spf=pass (imf26.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701987108; 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=he2OLnHhm9fYhtMTKd7MLARqNMmy+PBFtc+XNp9rWc8=; b=N9QUNpw9U6Ft7srqDiOY3JtyowSbQ3IaYULD3HJYKeHidvb+p5GwnmXW0F0h8rLFeKuNps BhipLaRWRjB6K8fQRh0dclw7kSd8tZawkh8OEaTSpYA2xNc3frhWS31l+W/jUviI6dfCzq FQplMpYaVODXoik4YmLW2usf4UY0wik= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=mMYBqqBu; spf=pass (imf26.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701987108; a=rsa-sha256; cv=none; b=8kaJFi2+HXAASfM6Pfr3hdwlxnCFoGXlqv0dHrxEPsxBx+xP8ycpJIIMWgYIzDgTc7bhhW qP4zzzwtGorb4FmvyxMiElKjHn52Hx0OxlZ7DJRmvFLyGz2b3bpgh1cg6lDYZthv6KaI71 ctvm4kxYROF7QXz5G261TzZN7C8CTKM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 0CC4CCE1F2B; Thu, 7 Dec 2023 22:11:45 +0000 (UTC) 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-Rspamd-Queue-Id: BB902140024 X-Rspam-User: X-Stat-Signature: ag8no4k9qtouxa98frcyr8z76z598xmt X-Rspamd-Server: rspam01 X-HE-Tag: 1701987107-972382 X-HE-Meta: U2FsdGVkX196bdrq2O8SAw7bDLJAh7ZJifh3iDA01vXoq0f2uZ/1pstX7cd51FqOru3IrbzzVjoBc2qmIlOvXUofRE3vPfqyl3d+oNxfbq5+cHTmIANfyvLS6I7BUtxR+hjzmkIzTf8arieZQIIR+SaWxYrpYTF+eD+qzTE0+dqFrhQi2SI1E+iOhRiPq0zh+R5v9aol7dnicroH8V9W9ptw80afGOEmsJVFTaZqlGUYZSKZI/MtMPoCLb8wvJUcNixriYCIb8pGncW00sc6ZFQBK/FENonDhVfGGvle4JhDsrCfnrRV6+1JnWKQto7iMqZ2DRoCOBw4z1Dqxd+KjiFRhjsOCxWdpruVsxeRFL+PRO27CQI7EWHTe4F9ykH4hUxPs4/A0iR2lCJY8NMLD1vA3q4GPv9qLZjop1p6C0+F8S8kS3RJAS+rP6tGRlZIC1Or0eurroO7jpZ/XX3lIuepQnpOfsmVPs1Z96+9yH+3Ncekg50yCGw1N4PTjHY8CtMqjsDk4jdw9luYbJc5dnZIFq2FahV2CL03Z45ktzz2cLqwWi5721+sEs9hyCen3ufgy+sj24oxRHwkMeZBuWGhGwigXvPVmldSBoreU9fd3xnsasVnCJj1YUyQCSEhEbWmIpFZxUaXnmK7t6dgMe7wDJ6qUoKQebLNbgarhEQCWGSsQC89ykU0jtdznBSZAkaTH3zDax1qMKAlV/CMDhXda68JraS5wYbPdWy9lmAf93Q4JT1sdRlWnxqk6+X1+HQbHEhAEaPOq04hM2tf8ORDmE1BpgIl8AzLjjVbMM7AtGd7WXJcVnzlFpEF8kzTI3FI/haywmUVGI3PbHjeJHYf5JMEJgyff3DfacSj6O2r5QvFlOY8vHngA9AWBHcHWPSWhMfkcHzMeZnwsf6ggMCmm77DnrxsKkk5Y9x83Jju446DuZbtTletdeUMJN/Bw2RCyfbGK9LZok0rjFA QpZxDhqh qZIvDgUw06vxDw/R3O2DDGq4FS0Fv2cBqYJVFLPeB3g9NMHX09QhSyGJTzRVE2MAsQLwi9BDdxIlN8o45ePblqCSZUGh32B+PBc9jxzs7EzpN5qZL3rUgI20XmfXEXckJ8e9dT5wd/fElKEhEd5UYk4lElIYF+ZG6ZO8kSvdxT+CxxwjnIIEH7cg7AEceqZBMQ16LCNvqIRtxJvEq4VF/xv91BtCdpJdPH9FcS6e1XQnIQ60fWA8KoIH0Nc7/x4ZgrliG8SA5HHp1aA0= 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: List-Subscribe: List-Unsubscribe: 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?