Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/zswap: remove SWP_SYNCHRONOUS_IO swapcache bypass workaround

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.

Link: https://lkml.kernel.org/r/20260202-zswap-syncio-cleanup-v1-1-86bb24a64521@tencent.com
Signed-off-by: Kairui Song <kasong@tencent.com>
Suggested-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Reviewed-by: Barry Song <baohua@kernel.org>
Acked-by: Chris Li <chrisl@kernel.org>
Acked-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Baoquan He <bhe@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <kasong@tencent.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kairui Song and committed by
Andrew Morton
ae1a645d 1c7b8d8a

+6 -13
+6 -13
mm/zswap.c
··· 1595 1595 { 1596 1596 swp_entry_t swp = folio->swap; 1597 1597 pgoff_t offset = swp_offset(swp); 1598 - bool swapcache = folio_test_swapcache(folio); 1599 1598 struct xarray *tree = swap_zswap_tree(swp); 1600 1599 struct zswap_entry *entry; 1601 1600 1602 1601 VM_WARN_ON_ONCE(!folio_test_locked(folio)); 1602 + VM_WARN_ON_ONCE(!folio_test_swapcache(folio)); 1603 1603 1604 1604 if (zswap_never_enabled()) 1605 1605 return -ENOENT; ··· 1630 1630 count_objcg_events(entry->objcg, ZSWPIN, 1); 1631 1631 1632 1632 /* 1633 - * When reading into the swapcache, invalidate our entry. The 1634 - * swapcache can be the authoritative owner of the page and 1633 + * We are reading into the swapcache, invalidate zswap entry. 1634 + * The swapcache is the authoritative owner of the page and 1635 1635 * its mappings, and the pressure that results from having two 1636 1636 * in-memory copies outweighs any benefits of caching the 1637 1637 * compression work. 1638 - * 1639 - * (Most swapins go through the swapcache. The notable 1640 - * exception is the singleton fault on SWP_SYNCHRONOUS_IO 1641 - * files, which reads into a private page and may free it if 1642 - * the fault fails. We remain the primary owner of the entry.) 1643 1638 */ 1644 - if (swapcache) { 1645 - folio_mark_dirty(folio); 1646 - xa_erase(tree, offset); 1647 - zswap_entry_free(entry); 1648 - } 1639 + folio_mark_dirty(folio); 1640 + xa_erase(tree, offset); 1641 + zswap_entry_free(entry); 1649 1642 1650 1643 folio_unlock(folio); 1651 1644 return 0;