From patchwork Thu Dec 21 00:57:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13500848 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 3576BC3DA6E for ; Thu, 21 Dec 2023 00:57:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9D778D0002; Wed, 20 Dec 2023 19:57:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A4D418D0001; Wed, 20 Dec 2023 19:57:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 915D18D0002; Wed, 20 Dec 2023 19:57:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 82C5F8D0001 for ; Wed, 20 Dec 2023 19:57:29 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4F26CA05E7 for ; Thu, 21 Dec 2023 00:57:29 +0000 (UTC) X-FDA: 81589012218.17.DF692C4 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by imf02.hostedemail.com (Postfix) with ESMTP id 7FF0980006 for ; Thu, 21 Dec 2023 00:57:27 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gjVHx5Yp; spf=pass (imf02.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703120247; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IsKyRwIIJMh6ypd8eGcHKjusmAjA6ghKRoJtNW0AIPo=; b=ZHLDOykOpdDpsQ/YzwnXDK31DJ3Wwe/gjkm4I7/4Ug/icX/PCjS2Frrr6jcUza0wZhTGhc K1H84WsWmkRe20LmSUU+7rylf1Ie/MbuLnah8sPWp42J65THhh0eSHDeKHmQPtYl7MiW0f +CSYH7xqYcFzPb1mwVZlYNNlInPqdDA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703120247; a=rsa-sha256; cv=none; b=qvd/UR47KHRECYvZ5zSB8fRhFvdGe43RSM6ovb/tpuYB8Uext+7FkUsRZ1u750JUrZQh1r TzAeBQq7Wml9Elst8d7l1zL7d+EjIyK6lvx/KVzuOe/gGPGFMVOCIbmCh2yqFrhk9FQ0rn 7FynlUrkZf68j2mJQLlPUiFCCl/sY6k= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gjVHx5Yp; spf=pass (imf02.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3b9d8bfe845so185837b6e.0 for ; Wed, 20 Dec 2023 16:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703120246; x=1703725046; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IsKyRwIIJMh6ypd8eGcHKjusmAjA6ghKRoJtNW0AIPo=; b=gjVHx5YpSxSW42BTa9hN0n4j2iX0Y5Q0fwWK/2m4+VpwgLzxOoBQ6ODqWidXPESKby gjah/G5U8KhOsrvh24emoFex403WJ1Ra72AUKiGDzz/0WiW9xX19Th85a7Y/hOAvgGSG YLC6m3uwaZv+9KH/JKTBFtNkWgfJqx2FZPyf1G2AHGQQpiLxir5IKqjcGX15VogQySvK S2ILVIaMSpKNpxXtSCyT8HcvZJR9YET+OAOTe9dq7YhuODR6LCZYc+sHeqWPIuZ62E2P pyTdX/tLxKLbiCU+8PAadeoNrQ37e3oXRRRIzcrpkVajzbVETviM/xdXieY6YdArhncu omYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703120246; x=1703725046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IsKyRwIIJMh6ypd8eGcHKjusmAjA6ghKRoJtNW0AIPo=; b=MWzoG4XcBzrEjIXaqcR3d6dvUTPz99VfIAeGIsKUmspOQSCkoDgMCc3FRtKxn2kehk 343jD6aN5FECWK24+KDCopG+tlp1ylwESu/gMp/SIYQ8pFAAj/vUfybciHIgR9CPjCYd pcio7u0gL07z83ZckmcBC2TRfSnI+vi/rJEj1YVewltbrGNX8NgZGaMfjfm/Rc4UFOA1 XlxlIstU3MM69sTHY+rH7+FfRjKsyztL90uTuy/JvA/TogU5qLpcUnCdYPSlgHHkh7Us 9d+jZlBzhEEaDurlEx4ohgEjaZkbrhPo7cgB8NqKFF5I0+XIYRqq4V875t9Hd3hcAVWE nWJA== X-Gm-Message-State: AOJu0Yz/7HvfMK3hv2tKrcEgCd3DFOf4/5r+cRUSGLRn0Cf2EpKZ8LJa Up5sVBLYPraWbfSx57rwioY= X-Google-Smtp-Source: AGHT+IE2svPs9OIqJz6GQFQGm3iwTc8Gs7lh91C7UHNps90ESUqToUj97RVKlK0QX9L3bsZ5gNHDng== X-Received: by 2002:a05:6808:1489:b0:3b9:dddb:2921 with SMTP id e9-20020a056808148900b003b9dddb2921mr26162193oiw.78.1703120246576; Wed, 20 Dec 2023 16:57:26 -0800 (PST) Received: from localhost (fwdproxy-prn-020.fbsv.net. [2a03:2880:ff:14::face:b00c]) by smtp.gmail.com with ESMTPSA id j20-20020a056a00235400b006d6b6c0b569sm358349pfj.219.2023.12.20.16.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 16:57:26 -0800 (PST) From: Nhat Pham To: akpm@linux-foundation.org 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 Subject: [PATCH v6] zswap: memcontrol: implement zswap writeback disabling (fix) Date: Wed, 20 Dec 2023 16:57:25 -0800 Message-Id: <20231221005725.3446672-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231207192406.3809579-1-nphamcs@gmail.com> References: <20231207192406.3809579-1-nphamcs@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7FF0980006 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: mqujx47i3wpfsaqw3yceko697b9dpne1 X-HE-Tag: 1703120247-618898 X-HE-Meta: U2FsdGVkX1+GYV8NHmUjBgO2uBiDBvWAJC8n0ZnYHXnxNBlaIVwCxEq7O7kUHkv29IgJeVFttyomItn6nmjNNGoDHyHuuIGivVPGQCrOxw/zRjNoa6FBm1TI6MWqX9NPJydZIgLxSwQiN5KQJsFQ857dh+0hK6v9F134fG4DrDcxvdfCIUOyBJazLMXEyp0X9BNnUPPHFjlz3N2q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MHJ1uLVr663TU8ecJ6lkd+UYl8BYJscgBooZmS5WqO0dDV1WJJzeG19ZpstYJ524dbINSwR2OUr8X5ST9H2WkPK58ki7cywaVwrMIwsWUOxHy2Y7abljYL0dBcYw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000654, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add a caveat about recurring zswap store failures leading to reclaim inefficiency. Suggested-by: Yosry Ahmed Signed-off-by: Nhat Pham Acked-by: Chris Li --- Documentation/admin-guide/cgroup-v2.rst | 5 ++++- Documentation/admin-guide/mm/zswap.rst | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 2b4ac43efdc8..5ec7dd753cd1 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -1686,7 +1686,10 @@ PAGE_SIZE multiple when read back. When this is set to 0, all swapping attempts to swapping devices are disabled. This included both zswap writebacks, and swapping due - to zswap store failure. + to zswap store failures. If the zswap store failures are recurring + (for e.g if the pages are incompressible), users can observe + reclaim inefficiency after disabling writeback (because the same + pages might be rejected again and again). Note that this is subtly different from setting memory.swap.max to 0, as it still allows for pages to be written to the zswap pool. diff --git a/Documentation/admin-guide/mm/zswap.rst b/Documentation/admin-guide/mm/zswap.rst index cfa653130346..b42132969e31 100644 --- a/Documentation/admin-guide/mm/zswap.rst +++ b/Documentation/admin-guide/mm/zswap.rst @@ -159,6 +159,10 @@ zswap itself) on a cgroup-basis as follows: echo 0 > /sys/fs/cgroup//memory.zswap.writeback +Note that if the store failures are recurring (for e.g if the pages are +incompressible), users can observe reclaim inefficiency after disabling +writeback (because the same pages might be rejected again and again). + When there is a sizable amount of cold memory residing in the zswap pool, it can be advantageous to proactively write these cold pages to swap and reclaim the memory for other use cases. By default, the zswap shrinker is disabled.