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=1796229307; b=FFC2meO/rZ2dK42Laa1bUfPhQKQ3urJQqyYcuovpIxgYfTOECHizC0s/vgl+x1qSN+4I saoPN4Sa2moZU/hTOUeqEjGYgiU/xaB1aA2JdpOZ2Zjj4Zpu1sSSZeRMq2+ix0BC4FiBg A6dB7606uCl5Vxd4aX1ECqRhTDFU/1gk/Bs7hcOhVerRd9ZVUqHjFKHNd20an3UAdTboK 3o8AUd2WzIAxHs0/Tevc7G47Hnq/GmhwYj61PI2LueYsexH810mTBFqJW0AWW76iKjWPB P0389F0Rj8H4ipy7pLQdTQay27Z3z3avqoExfHx+VaY8bq8fqcNxccQPGoJ/ipgve3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796229307; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=9k8jLGWApOUglKTgomT22sqsehCHE7Giy4AzbXHlx+k=; b=PsCsJTsvuweCIPmqYO4JgZreu41Qg7iDv2duyBlnV2qdPBKeQrc3T0Twz8tKIU9IxNP4 E/tk5Lx8OCzcQGu4/ebLr90uhFDsMP2So8GmgNG7Ek53Z2yuL6G0lfmW7bofFu7BAueZj JaoIHkEfeoY+52qyHrVT2BJMSsjfldo9fFsYYmV32ko7r1fSkQ2c2/8rEkMqYWWAMaQyc k2VYsY9UeEBryOX3kDRCGaysNAF46NRNFEGTj6eXFuZqjUYMKO5A0EUQl8n7wjWP0fpw5 VHGr+NBKxGQT5ToaKMxQcVe8JOVPlVQXWcCiY2zrxe1UmEqARlD2plC2GVqtth8w+jg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=BOFwvm+0; 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 B1D5B606A31A for ; Wed, 2 Dec 2026 16:35:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=BOFwvm+0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E62101F00925; Wed, 2 Dec 2026 16:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796229307; bh=9k8jLGWApOUglKTgomT22sqsehCHE7Giy4AzbXHlx+k=; h=Subject:To:Cc:From:Date; b=BOFwvm+0hngb7Z8wu/bv8VshmxeuhD++6R5+yoMa6d74gHABuskePnFT9nKP0rQwx Q9gEmHGar29HViOTdI37si17jmApaO9jz1XcO/ltIBO86KqwWvc1oGaXb9je+n4a2G GnKeONf1NxeYrIm9O8WQCPFEV13IRbZ8sl/WKGB4= Subject: FAILED: patch "[PATCH] mm/khugepaged: don't map folios that are not uptodate in" failed to apply to 6.6-stable tree To: david@kernel.org,baolin.wang@linux.alibaba.com,hughd@google.com,kas@kernel.org,lance.yang@linux.dev,ljs@kernel.org,mason@kernel.org,pfalcato@suse.de,sj@kernel.org,ziy@nvidia.com,zokeefe@google.com Cc: From: Date: Wed, 02 Dec 2026 17:10:01 +0100 Message-ID: <2026120201-basis-idiom-f1a8@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 043a2260b96ffc13121a1dd65282e67eb2e1d8a8 # git commit -s git send-email --to '' --in-reply-to '2026120201-basis-idiom-f1a8@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 043a2260b96ffc13121a1dd65282e67eb2e1d8a8 Mon Sep 17 00:00:00 2001 From: "David Hildenbrand (Arm)" Date: Thu, 5 Nov 2026 19:16:44 +0100 Subject: [PATCH] mm/khugepaged: don't map folios that are not uptodate in MADV_COLLAPSE madvise(MADV_COLLAPSE) can map PMD-sized pagecache folios that are not uptodate. For example, shmem fallocate() can put such folios into the page cache. collapse_file() already refuses to proceed with folios that are not uptodate. Let's just do the same in try_collapse_pte_mapped_thp() and skip such folios, leaving handling to the page faults. Note that collapse_file() effectively clears shmem folios through shmem_get_folio(); let's keep this fix simple and simply let the page fault path deal with that. Fixes: 34488399fa08 ("mm/madvise: add file and shmem support to MADV_COLLAPSE") Reported-by: Chris Mason Cc: stable@vger.kernel.org Reviewed-by: Lorenzo Stoakes (ARM) Acked-by: Hugh Dickins Acked-by: Zi Yan Reviewed-by: Zach O'Keefe Reviewed-by: SJ Park Reviewed-by: Baolin Wang Reviewed-by: Lance Yang Reviewed-by: Kiryl Shutsemau (Meta) Link: https://patch.msgid.link/20261105-set_huge_pmd_uptodate-v1-1-a78d8a1b7117@kernel.org Reviewed-by: Pedro Falcato Signed-off-by: David Hildenbrand (Arm) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 4bbe319ef86f..964f78c3856b 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1888,6 +1888,12 @@ static enum scan_result try_collapse_pte_mapped_thp(struct mm_struct *mm, unsign goto drop_folio; } + /* Leave any uninitialized folios to the page fault path. */ + if (!folio_test_uptodate(folio)) { + result = SCAN_FAIL; + goto drop_folio; + } + result = find_pmd_or_thp_or_none(mm, haddr, &pmd); switch (result) { case SCAN_SUCCEED: