Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796328232; b=EoYdU/gNhj0Biei15dITxsAVq8TQ2dF42rAp/P+PK5KSkFAwDnO2ZfVfB9vw3Pab1y6z izkXtHyW78o3R9aJTqjVgmXyy7CRnqQ9nsrG1m8iosAr0UYxszK/CypZxEUmrqY8os/fh 2FWho2DKcFlBfiDvJq1BadDk3pspEFMiH2Xvj/NWqkzl+5QPp32nXNI/JOIuB3Vp8+WKZ I+pXpoPtOsrwV6KcHP3Xu0cdlQ+jCCeyt7RxuyoDSwCnoZgHE2Yo2GjFynpiZQYN4j6RN 7fxL2HumO3CLpsmO8PViGOtciFqX5B9DzmCpEAMpnS/JO4bTmab9tgWkfr5+1CCYYdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796328232; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=uugE4M33Ttk5fSQc4gpVqnd9n9AMop23OYIBTnd0HFw=; b=vzr05BoLjNyuCvqWU7LKaaGFG2s0mgNa0vS1YGbFc7V/SML6nkHXkYj/i4CcyDxQBB8z TrSTEFHUUF29g6pYNrQq7WxgCHuFskcYtvrvrVZq08f0c3JGxvO/fltIc3b3236qD7c5Q p7U0ACmTycC+wT7znpmtKE5VQjfMv/kapXVhZ/WIVdm1rO3vQg4DsfaoQTsZEaxlJARLV aN+xOahOBmRP0HiMQjvIgS1Lzh7UVI0yHZDDKiZB2I/nzCsySSlU9cvuYw00iq2WvnxPk 0Dwh0pLgvIiAb0Deu0o9D6fiJL4Gaa9fileO3xQcVBTRM64Ro/f4SHVWQSH8H1erH9A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=mXV3Qnw8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDE59606A322 for ; Thu, 3 Dec 2026 20:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=mXV3Qnw8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66CB61F000C2; Thu, 3 Dec 2026 20:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796328232; bh=uugE4M33Ttk5fSQc4gpVqnd9n9AMop23OYIBTnd0HFw=; h=Date:To:From:In-Reply-To:References:Subject; b=mXV3Qnw8ZnYFrKvBDCP2Pkzvt0r7BfYBXn+0pwZq4J7mmQb18+q92gMRKcla+gm8g RCzAa5rx0ZOwyXa01AVFY0homOSSBM8X3H/5VW4Sij00i0DjvmlGKwBbP/KYiLXNVE jDssif9KPaoV2qkCXtXTd6pX1Eal/wt/nom5CdYM= Date: Thu, 03 Dec 2026 12:03:52 -0800 To: mm-commits@vger.kernel.org,youngjun.park@lge.com,yosry@kernel.org, shikemeng@huaweicloud.com,shakeel.butt@linux.dev,rkeilty@meta.com, riel@surriel.com,nphamcs@gmail.com,kasong@tencent.com,hughd@google.com, hannes@cmpxchg.org,dgreid@meta.com,david@kernel.org,chrisl@kernel.org, chengming.zhou@linux.dev,baoquan.he@linux.dev,baolin.wang@linux.alibaba.com, baohua@kernel.org,atish.patra@linux.dev,alex@ghiti.fr,usama.arif@linux.dev, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261203180253.2129141-1-usama.arif@linux.dev> References: <20261203180253.2129141-1-usama.arif@linux.dev> Subject: + mm-bypass-swap-readahead-for-zswap-fix.patch added to mm-unstable branch Message-Id: <20261203200352.66CB61F000C2@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/shmem: bypass swap readahead for zswap has been added to the -mm mm-unstable branch. Its filename is mm-bypass-swap-readahead-for-zswap-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-bypass-swap-readahead-for-zswap-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Usama Arif Subject: mm/shmem: bypass swap readahead for zswap Date: Thu, 3 Dec 2026 10:02:53 -0800 Commit 7ed825f0f766 ("mm: bypass swap readahead for zswap") made do_swap_page() skip readahead for zswap entries, but shmem_swapin_folio() still only skips it for SWP_SYNCHRONOUS_IO devices. zswap decompresses in the faulting task, so readahead has no I/O to overlap and only slows the fault down. And since zswap loads are exclusive, pages read ahead but never used stay uncompressed in memory until reclaim compresses them again. Use swap_entry_synchronous() in shmem_swapin_folio(), like do_swap_page(). zswap entries then take the SWP_SYNCHRONOUS_IO path, which already uses order-0 folios once zswap has been enabled. Entries on the backing device keep cluster readahead. On productions hosts that run VM workloads backed by shmem guest memory with memfds and swaps only to zswap, about a third of shmem readahead pages were never used. In a QEMU guest with a 2 GB memfd in zswap and page-cluster=3, faulting in 10% of it left 36 MiB in the swap cache before this change and none after. The memcg grew 24 MiB less and the faults took 12% less time. Link: https://patch.msgid.link/20261203180253.2129141-1-usama.arif@linux.dev Signed-off-by: Usama Arif Signed-off-by: Andrew Morton Reviewed-by: Yosry Ahmed Reviewed-by: Nhat Pham Cc: Hugh Dickins Cc: David Hildenbrand Cc: Baolin Wang Cc: Johannes Weiner Cc: Chengming Zhou Cc: Christopher Li Cc: Kairui Song Cc: Barry Song Cc: Kemeng Shi Cc: Baoquan He Cc: Youngjun Park Cc: Alexandre Ghiti Cc: Rik van Riel Cc: Shakeel Butt Cc: Cc: Cc: mm/shmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/shmem.c~mm-bypass-swap-readahead-for-zswap-fix +++ a/mm/shmem.c @@ -2570,8 +2570,8 @@ static int shmem_swapin_folio(struct ino /* Look it up and read it in.. */ folio = swap_cache_get_folio(swap); if (!folio) { - if (data_race(si->flags & SWP_SYNCHRONOUS_IO)) { - /* Direct swapin skipping swap cache & readahead */ + if (swap_entry_synchronous(si, swap)) { + /* Skip readahead: synchronous device or zswap */ folio = shmem_swap_alloc_folio(inode, vmf, index, swap, order, gfp); } else { _ Patches currently in -mm which might be from usama.arif@linux.dev are mm-zswap-use-separate-compression-and-decompression-requests.patch mm-zswap-use-stack-requests-for-synchronous-decompression.patch mm-bypass-swap-readahead-for-zswap-fix.patch fs-proc-task_mmu-read-the-pmd-once-in-smaps_pmd_entry.patch fs-proc-task_mmu-dont-read-young-dirty-from-a-non-present-pmd-in-smaps.patch fs-proc-task_mmu-account-device-private-pmds-as-present-in-smaps.patch