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 D0033D1BDC4 for ; Mon, 4 Nov 2024 16:34:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4EEA16B0085; Mon, 4 Nov 2024 11:34:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 49D1D6B008A; Mon, 4 Nov 2024 11:34:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33DC56B008C; Mon, 4 Nov 2024 11:34:12 -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 122706B0085 for ; Mon, 4 Nov 2024 11:34:12 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BE0CB1A03B6 for ; Mon, 4 Nov 2024 16:34:11 +0000 (UTC) X-FDA: 82748959608.29.CC340B2 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by imf17.hostedemail.com (Postfix) with ESMTP id 099F040014 for ; Mon, 4 Nov 2024 16:33:44 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=WebR2bfh; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.170 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730737966; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sX1khw0TKho0yFzPsMp3dwNcz3lK+q/XoPKlIPJlqlM=; b=UWuCTk3y7QkSjQv/T4m+O/6aG6Uy4y5RZ2n38i5FV2o2Yv8Gl0ZmWV7xlYisbtZqX4vydL 9f0/16/06UM5LiLf3bkyu9m1XCcIxsxFbYBS4x1P2Wc2jbkcgsq/IsM8kFtTZ99PJczVkR w4HiwHpqmIZv2YKtwQsk27MvpoWA5zk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730737966; a=rsa-sha256; cv=none; b=kNvmvazB8Gs6PNDYcQiBTPviOgSpQixGwgBw2j8SGf0IwWrL7N0kIo7h/oiEsIp+Td5IyH ipX2RNga6D4r2gaFaJ+TnJ1kZc6rA9jALRMH4bRU4LJyjLyRVFypw30uHs3RHu8Lt14sRl tOoK9a98Nu3U6PZcBIZB0LloTcjCGQk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=WebR2bfh; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.170 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-4609d75e2f8so45690531cf.1 for ; Mon, 04 Nov 2024 08:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1730738048; x=1731342848; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sX1khw0TKho0yFzPsMp3dwNcz3lK+q/XoPKlIPJlqlM=; b=WebR2bfhITrk/enjjzIbX1dOHDmb2AEyAIkA/nFRV3OFLwuHDPERPW4TyvDMGrYiZm OG8CRFhcsS3b8WLR3W/eTstzeyIN+cV7Kp8LZ0SMK+qbBi9Msqb2DPqueBJN41uD9soX c9FDD0MV/BOt3nr8qmXo+10rWMynMgQLALOZbHppgctGD1IszlxJiK4C5rmBk7eQ1VGh YmhsYqXVvgal0GWb0j185JrmtUf2eepfZc1c3wtb7KCWWh1eP5/leLIBaQ2Bnwx8RRXO FA+tVzYYbcTE8XJ17ETtmnLQbS6B9W6/Bu01PVaBXB+21eB2pWOjYD6GFB4REzVW6WjU 8Big== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730738048; x=1731342848; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sX1khw0TKho0yFzPsMp3dwNcz3lK+q/XoPKlIPJlqlM=; b=CAjQ4ieOAeW312xOJW7xywtrdVSGORqqShzod8ZSoBYW781ifkKxy+tthYZhMo9mKp eB/aGeq+myZXKIRQGyVooneFfabFvexwyinm1NMii2v4vHPzWVcuflSUeQVLxXvhlkaD 0jcA48r0dI9FAhoJLUmh1+B5yYrrI8PYU4goeEHL9WQZQzKZxly5voh+bn1TGwAnsM/S /mFYxEOf1H7Poqiwf7enRrw+/Os/1ih211kL7ZFbG361R4fxCB9c96uVwzvI6p/Drmdr cLIAILuODkT0peU7J4KzDLUj+gGZZOokNid+//kpXhjPXbIZkjanp+tE8mpN8nmo3eWD O5lQ== X-Forwarded-Encrypted: i=1; AJvYcCWN6Q/62KmicvCgdDz7xpkm0LIs86Gc/jYU1LtwwrB/dktyvQWlSzDQCLy/m4qXpAmWZTVqzPzPrQ==@kvack.org X-Gm-Message-State: AOJu0YzPvcfYpPre+eWRF0ChoW3WrmuU7i9cnVDvUbEH5ZK2EhnndOMq ssXDH+b+xILhpPuwxtNjriNCzciG1JxpEX756cMJlHokl07Vgab/ay4jaTj8vx8= X-Google-Smtp-Source: AGHT+IE5cRit64NOIWXFwfHPa/+8dF20E77ojQpVMudW8g0lIn+CghLrTU4e1Mcq/buC7Bkm41/HIg== X-Received: by 2002:a05:620a:240a:b0:7b1:45be:2e98 with SMTP id af79cd13be357-7b2f3cfa7c4mr2535810985a.10.1730738048549; Mon, 04 Nov 2024 08:34:08 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b2f3a8114asm433769085a.106.2024.11.04.08.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 08:34:06 -0800 (PST) Date: Mon, 4 Nov 2024 11:34:02 -0500 From: Johannes Weiner To: David Hildenbrand Cc: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Barry Song , Usama Arif , Chengming Zhou , Yosry Ahmed , Nhat Pham , Hugh Dickins , Matthew Wilcox , Shakeel Butt , Andi Kleen , Baolin Wang , Chris Li , "Huang, Ying" , Kairui Song , Ryan Roberts Subject: Re: [PATCH v2] mm: count zeromap read and set for swapout and swapin Message-ID: <20241104163402.GA810664@cmpxchg.org> References: <20241102101240.35072-1-21cnbao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam10 X-Stat-Signature: gb96mzji3rya5caq71g93era6o9p3tr5 X-Rspamd-Queue-Id: 099F040014 X-Rspam-User: X-HE-Tag: 1730738024-204450 X-HE-Meta: U2FsdGVkX1+6hvJkefkeQ1ihWXVVSdwKy8KwPgWvhy/SyczjtGQPmh4QkAloXPCs+R2mvy1zU4uqrCb+wW0Q3VT2N0YKB2fdJ44e4t86yEIHEz72KyKbhRSSaFAlQZ5hvcFbrX2DdYFYbvexi+5uUwQikLe1zm18HZmy3wCzJxpE5hmGmbRHI0cHnQTVa8VpyPs9HNBAMdhHsFFvxPJGncK2pP228MYxD+vIp9Lfsu1wMcKlloAyiJUV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rbeuXgBYY6iA1KRfGj0kkx/zZVbhcm1KWl6+ety38tSKV++CO8yP/OwukNOXFPkZCPON4TB8sFmWhkBjIuwDJNtTx7jwuyV5atsbbW0+vavy3lNsCMJAayr7mXzu3t7lpBWrPrqwQ== 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 Mon, Nov 04, 2024 at 01:42:08PM +0100, David Hildenbrand wrote: > On 02.11.24 11:12, Barry Song wrote: > > @@ -1599,6 +1599,16 @@ The following nested keys are defined. > > pglazyfreed (npn) > > Amount of reclaimed lazyfree pages > > > > + swpin_zero > > + Number of pages moved into memory with zero content, meaning no > > + copy exists in the backend swapfile, allowing swap-in to avoid > > + I/O read overhead. > > + > > + swpout_zero > > + Number of pages moved out of memory with zero content, meaning no > > + copy is needed in the backend swapfile, allowing swap-out to avoid > > + I/O write overhead. > > Hm, can make it a bit clearer that this is a pure optimization and refer > to the other counters? > > swpin_zero > Portion of "pswpin" pages for which I/O was optimized out > because the page content was detected to be zero during swapout. AFAICS the zeropages currently don't show up in pswpin/pswpout, so these are independent counters, not subsets. I'm leaning towards Barry's side on the fixes tag. When zswap handled the same-filled pages, we would count them in zswpin/out. From a user POV, especially one using zswap, the behavior didn't change, but the counts giving insight into this (potentially significant) VM activity disappeared. This is arguably a regression. > swpout_zero > Portion of "pswout" pages for which I/O was optimized out > because the page content was detected to be zero. Are we sure we want to commit to the "zero" in the name here? Until very recently, zswap optimized all same-filled pages. It's possible somebody might want to bring that back down the line. In reference to the above, I'd actually prefer putting them back into zswpin/zswpout. Sure, they're not handled by zswap.c proper, but this is arguably just an implementation detail; from a user POV this is still just (a form of) compression in lieu of IO to the swap backend. IMO there is no need for coming up with a separate category. Just add them to zswpin/zswpout and remove the CONFIG_ZSWAP guards from them?