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=1796221231; b=c473GH/aJ8ZyvfvjrO4jwOZuuLVbZFTWYag/THv9D9IB7SS5BnhwrzgwQ7ifaHiBlcR7 p6UNXHLBclOz7ONHMXHjIFULHtq10QsFfGkQvx5GhjHKbxSiUblR5qXz6hYd5UGHcss/B wBJn8Ea+e2zifVPzi8OLpWffOqNaQyEgqVbx3qH+ynW5EeX8L01neP0xpi6s43e4Fz1NP /Om63YFQIGFIOGL4/rjVXgMe5iG85YMKHmCt1j0ZgJPdfoNWTONO/oxm8U/vhqDvrx9Et 7BcDz11GJt9mBewAPC6j+TPdxhJ5WhaTvSTftd9+LlIhjwFtl/I8O7cRqOVVSiT9asw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221231; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=fpzvlcVQ124Z+Swh9w3Z6kaxPqJA/cXSpRvHbConQD8=; b=esrdIpmiii8zTwdOATDURRkZeiYJZKMcsGnmNs8VL6GQVqqOUBrjqpJhYYUZtw61ruyD 7JHeVou3bX8prCsZmQ1BorjHrsqhX2vx+zBeL88NkpWvhn96ipJAZtIgcKyax4ZDnY5bm NJR5J4+ySc0GKnJlnhBi+ukDAp7M8XpGkEsixfzsG2ZJZZC8toVXUuv0FRNKFkQsPND1f LHLDTrOFFyWJxumya5+eyIVB49zhOHms32B382xecr0S6OM9B656l9ZbhFp9SWq1XvnM0 5Ly0ohUAbciADrwPlc46IsfcTNCuoNYfx0PPV5yId+nh3WGv3xjUatWQ108rPoGNKew== 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=iurOl+ZN; 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 5D517606A325 for ; Wed, 2 Dec 2026 14:20:31 +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=iurOl+ZN Received: by smtp.kernel.org (Postfix) with ESMTPSA id A649C1F0089C; Wed, 2 Dec 2026 14:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221231; bh=fpzvlcVQ124Z+Swh9w3Z6kaxPqJA/cXSpRvHbConQD8=; h=Subject:To:Cc:From:Date; b=iurOl+ZNFL3l4n5eNwYrK3/LdBMMpMe+24vK5G0hwb3adB3gSQPkMoLWIjIUdOW9X 7//iFuoeHBO3Sw4O2X3d60UcaCz+uichfpz69Y7EO7UtIBjgw8BSLCSAQ3Td/EQvod I+rthPRonYBpq11rJibhcomt1fIdMeEEYbzPgjJc= Subject: FAILED: patch "[PATCH] mm/khugepaged: don't map folios that are not uptodate in" failed to apply to 6.1-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 14:16:43 +0100 Message-ID: <2026120243-sedate-penny-9d9e@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.1-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.1.y git checkout FETCH_HEAD git cherry-pick -x 043a2260b96ffc13121a1dd65282e67eb2e1d8a8 # git commit -s git send-email --to '' --in-reply-to '2026120243-sedate-penny-9d9e@gregkh' --subject-prefix 'PATCH 6.1.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: