From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796408614; b=ENeFHKH+NWVRKjLuvkDYOwNS3SHmpOx4YOCU6HY+nmsuCZiBr7fxYD2Wnt/8P4Fy6MQG n5C6qA/7ANcI2zH8Eo4KpqvjQClchRQMMU3TQo8TrKpsZfhhkoSYEYkOm+pg5W0eL7H+X RsEX6XN6KrB2o0UPicBUg6LH6c2ni8pY17Jpf18Lgvgv2G/eUglChT3RDUvurpGHCFJQH 0t3eykz+rL97t5CQ7J6jCrXDsPXWuMOxoiqe1U5daiaocfRDjGzJhYYlvPmBSJUuNVnnb 7CMPZd+WuZHCoQGMER/kdrzTHYcblWZLqT8Zhqig1u7GkMUPQvoy2Tk6F/Xb4U7kgig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796408614; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=A5q56FjfKReVDp6V5MNIrkRf0I0BcyuDlz3pCoDQ/Dw=; b=fgaqG2bLnVx0gnaGtUO4EFpYC8cSLFhGInpAtrXLFIFr5G8xSEa4F5jqbCLDNR9K4YGm WenTdpfEuCYXh2i2nQLCnYK0Btfn+O81kPeggKmUSb4WwMCuIxwppC0ozPW7vWYz1SYz7 BAh0IAWsZ1ltaEECxwVGWiaGCGZyMpi3EtvD5Cd5kFuhy425CEYfU31W3M5RS6P94l/cO XPsOgFWRA7tJj8PerFqxOxQfBW4kq1Us3xkN1rnQN1zWTR3IJ1E5aA6rXM1BFTs/IlrYe YS2LGw80v0T5BauV/DShJw6CjY1/wwNvcjVn/Qzz217nDE9MX4GNza05xsSqGFZ5MMg== 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=wDVP5bLK; 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 A82C7606A338 for ; Fri, 4 Dec 2026 18:23:34 +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=wDVP5bLK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 507E61F00A06; Fri, 4 Dec 2026 18:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796408614; bh=A5q56FjfKReVDp6V5MNIrkRf0I0BcyuDlz3pCoDQ/Dw=; h=Date:To:From:In-Reply-To:References:Subject; b=wDVP5bLKQnkb6ylD2VsbvnfitBocISWnFUyebt4O8S1cYGTpjd7KJtvFStR8sE6GZ 09lL42kWQNr140jzenKnDeSFIvq3l4V7P3lKwUAogJM6qeIPK80erlKyLpAqDDJvgZ +W6P8lD9uUQXwwu+PFbZws0ytao1QihsP6Ie176s= Date: Fri, 04 Dec 2026 10:23:33 -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: <20261204182334.507E61F00A06@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 Reviewed-by: Barry Song Reviewed-by: Baolin Wang Cc: Hugh Dickins Cc: David Hildenbrand Cc: Johannes Weiner Cc: Chengming Zhou Cc: Christopher Li Cc: Kairui 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