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=1796328879; b=xTChF7KgwmYF4qYKZbOL+ix6JMs2Ddo6vvVXl2iBuG7e7Q1yvqvV02ioIRGau7eN4zxs vKKMy6BQv549GMU/FnogL2LK/+ej3VbtnDf+JSDOvdSfMZyFpGIyq4ESfa5n4veGEir7+ WPlxFRzzjyIMnx+FuHZpj/XmXmqdBG9IwUyV31UCTYrEO6QV5Nw+mRe67yMaLhgU2iOcj LBx9nrCc+zQojq97nmYLqj1z5xlG9CIiaUedkpinCATwCV8LygWLLBPmhY2ibf31l2sxz ESL+BQ8B3wFkWYJmA4H+utZdQoGaGIyG1prX/ayEMHmkW7OljwpfV8I/EKYa5l3achg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796328879; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=vRNnsiZy9TQ3ZKaKWAHkW3mHVe1ij3LQBVqWWeWm3ZY=; b=ZpSrYvuVqfZEz/0G5LUgaVAalp8Fzb2ORrR1qMBvv6dQ3PgDgi+gdFv0qLM+CK4PbUoE +2xZZu9jr4HNquU8ORR+ouAdHtW1aK8vSQlXFgTAkm3CLx76frA9/92zb/3t4/7T/jSGg +fBQGrgBO3mH2Zy+GV7UD0Er51dYvYEJM4wM6fqVQGtOhAkXf4Sz8PcdjSM4C+tM4Vs8K iTHI6YBQ5d7ujpS+/lrimUHiFyYScB7kkIJ4Ek1OMmuOu4xACjJZnWEeB+pLAti14mU3q WYXRUlUgPv4JXWeAKj8MDuTkpmVaDGdNYbxWgifsvUIthDodzgtw1YE2VXe0CqrH4cg== 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=BNaXlkqN; 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 72B04606A322 for ; Thu, 3 Dec 2026 20:14:39 +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=BNaXlkqN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CCFC1F000CE; Thu, 3 Dec 2026 20:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796328879; bh=vRNnsiZy9TQ3ZKaKWAHkW3mHVe1ij3LQBVqWWeWm3ZY=; h=Date:To:From:In-Reply-To:References:Subject; b=BNaXlkqN5YSZ6wrP5Nd41cTOVYff/AwHQQRir3N55RpfdZzUpH/xaAv3hJX+k9HhF 1fXvRUWF47miHSO+p2Wdw/TDRMnj+Ntqn92pgdGxG0/M/grdJiLYbb9RUg20y/2fIH Hn1q/FFGBu2yRgMFHfqJKaUBYPoAT7KGpNV99+jo= Date: Thu, 03 Dec 2026 12:14:38 -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-shmem-bypass-swap-readahead-for-zswap.patch added to mm-unstable branch Message-Id: <20261203201439.2CCFC1F000CE@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-shmem-bypass-swap-readahead-for-zswap.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shmem-bypass-swap-readahead-for-zswap.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-shmem-bypass-swap-readahead-for-zswap +++ 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-shmem-bypass-swap-readahead-for-zswap.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