From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACB41242D7C for ; Mon, 2 Feb 2026 18:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770056577; cv=none; b=NlC69f+jPO/iBK5PxPvchfSY5WMXwUavXaFVqUQebKrirdCjhK+nC10a8ryEHeNkHpZJi/fLd42/xZhubgsYz2KfKy2z3zKTmfesYvi6gkqYXNA6P+ep2jVECE9dAvIMYJEH/99GCNBE43ALXNjKdKomuVcPQtjhp54qQYBnqBU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770056577; c=relaxed/simple; bh=yTbKlhssYa+J+5WXq31Hb2HVv88TbxVkZ8xgo+2qC+8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UCMVXdZsNVj4z1vR1dSKJdWevp5K38FNihU6RzZuYwItf+2E+nTuhJSsH7xtNMOXUP+5nL9XzIsvbjCSPnzGHv0MhYPEogHQJckO7SggXPS8zhxgMykHqsB4GAdZqZaP10xQmqbDHrj5bHjrHmLJ+pV0HZlvUbTyteXJOMx9WlY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PxS71KXE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PxS71KXE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43208C2BCB0 for ; Mon, 2 Feb 2026 18:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770056577; bh=yTbKlhssYa+J+5WXq31Hb2HVv88TbxVkZ8xgo+2qC+8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PxS71KXE0XX8PS754fVKeQyfOKjd0DlyFHlzQV499NC9EF9mWn6RitGkA6KJ6Xq69 klgA63gHeLUh4euLHPdm9+JuBLjY3egpsqCJKVSnQ01dXgTB6BtEQcsgA5hh3I7ynQ K1MTPAm8crzd26gLRnUGS4TMAzk03ubqjrp5oCN0b40cv/X+IZMr4oN+yMRnkoOeA/ +UuOF0uzHC0ghsRehC28VqytsmxFJalU3LIc5LcdKvfQkY5yGhTLlWIbiuhfuGQELQ jqejgxUP8PuMBdnpO1HcxFiw/R5j8SgQKrPfiKu6JCOVkl1eXDaez9JemTzlqhGGBm kKajcaLOjVlLw== Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-790992528f6so43387037b3.1 for ; Mon, 02 Feb 2026 10:22:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU8+OzkQONCaYtArlw0F8AEnCS7+857Bja01/66nvnzyvrkTSWEf4t+AuwsBYfLaHU2rjXyB7jI8fmbBYE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxgw/u5yStfgcMV0Bu8K7T1O2bTzcJ4Z73U3NfgGflzPYGpAs20 JJJUjA1tikujWLFtLuOSttSL0QDSGBminLX4CLvOUbahZ22A5I5x4ZsU6ZQp3MlacQ8xDPRdOnk BhfO+lX2rtGN6ekGevaN7WtJpqE/lA+M1zBbnxXQdrA== X-Received: by 2002:a05:690c:60c3:b0:794:70f6:a87f with SMTP id 00721157ae682-7949dec6ec3mr105333257b3.19.1770056576448; Mon, 02 Feb 2026 10:22:56 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260202-zswap-syncio-cleanup-v1-1-86bb24a64521@tencent.com> In-Reply-To: <20260202-zswap-syncio-cleanup-v1-1-86bb24a64521@tencent.com> From: Chris Li Date: Mon, 2 Feb 2026 10:22:45 -0800 X-Gmail-Original-Message-ID: X-Gm-Features: AZwV_QiSj4eo8Mfc4E0Q1W-pDir9H_xKh1YofvGSFBSixKG-idrDQtrCmrSkD-U Message-ID: Subject: Re: [PATCH] mm/zswap: remove SWP_SYNCHRONOUS_IO swapcache bypass workaround To: Kairui Song Cc: linux-mm@kvack.org, Johannes Weiner , Yosry Ahmed , Nhat Pham , Chengming Zhou , Andrew Morton , Baoquan He , Barry Song , linux-kernel@vger.kernel.org, Kairui Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Feb 1, 2026 at 9:47=E2=80=AFAM Kairui Song wrote= : > > From: Kairui Song > > Since commit f1879e8a0c60 ("mm, swap: never bypass the swap cache even > for SWP_SYNCHRONOUS_IO"), all swap-in operations go through the swap > cache, including those from SWP_SYNCHRONOUS_IO devices like > zram. Which means the workaround for swap cache bypassing > introduced by commit 25cd241408a2 ("mm: zswap: fix data loss on > SWP_SYNCHRONOUS_IO devices") is no longer needed. Remove it, but > keep the comments that are still helpful. Acked-by: Chris Li Chris > > Suggested-by: Yosry Ahmed > Signed-off-by: Kairui Song > --- > mm/zswap.c | 19 ++++++------------- > 1 file changed, 6 insertions(+), 13 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 3d2d59ac3f9c..8cd61603ff79 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -1589,11 +1589,11 @@ int zswap_load(struct folio *folio) > { > swp_entry_t swp =3D folio->swap; > pgoff_t offset =3D swp_offset(swp); > - bool swapcache =3D folio_test_swapcache(folio); > struct xarray *tree =3D swap_zswap_tree(swp); > struct zswap_entry *entry; > > VM_WARN_ON_ONCE(!folio_test_locked(folio)); > + VM_WARN_ON_ONCE(!folio_test_swapcache(folio)); > > if (zswap_never_enabled()) > return -ENOENT; > @@ -1624,22 +1624,15 @@ int zswap_load(struct folio *folio) > count_objcg_events(entry->objcg, ZSWPIN, 1); > > /* > - * When reading into the swapcache, invalidate our entry. The > - * swapcache can be the authoritative owner of the page and > + * We are reading into the swapcache, invalidate zswap entry. > + * The swapcache is the authoritative owner of the page and > * its mappings, and the pressure that results from having two > * in-memory copies outweighs any benefits of caching the > * compression work. > - * > - * (Most swapins go through the swapcache. The notable > - * exception is the singleton fault on SWP_SYNCHRONOUS_IO > - * files, which reads into a private page and may free it if > - * the fault fails. We remain the primary owner of the entry.) > */ > - if (swapcache) { > - folio_mark_dirty(folio); > - xa_erase(tree, offset); > - zswap_entry_free(entry); > - } > + folio_mark_dirty(folio); > + xa_erase(tree, offset); > + zswap_entry_free(entry); > > folio_unlock(folio); > return 0; > > --- > base-commit: 2c263046cbe6d9d5fce3dfeba063f199f7e6298f > change-id: 20251226-zswap-syncio-cleanup-a05b7fc6180f > > Best regards, > -- > Kairui Song >