mm-khugepaged-return-eagain-for-scan_page_has_private-in-madv_collapse.patch removed from -mm tree
The quilt patch titled
Subject: mm/khugepaged: return -EAGAIN for SCAN_PAGE_HAS_PRIVATE in MADV_COLLAPSE
has been removed from the -mm tree. Its filename was
mm-khugepaged-return-eagain-for-scan_page_has_private-in-madv_collapse.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Vineet Agarwal <[email protected]>
Subject: mm/khugepaged: return -EAGAIN for SCAN_PAGE_HAS_PRIVATE in MADV_COLLAPSE
Date: Wed, 29 Apr 2026 19:34:34 +0530
MADV_COLLAPSE uses errno values to provide actionable feedback to userspace. Temporary resource constraints are mapped to -EAGAIN so the caller may retry, while intrinsic failures of the specified range are mapped to -EINVAL.
collapse_file() returns SCAN_PAGE_HAS_PRIVATE when filemap_release_folio() fails while isolating file-backed folios for collapse. This currently falls through the default case in madvise_collapse_errno() and is reported to userspace as -EINVAL.
However, filemap_release_folio() failure commonly reflects temporary folio state rather than a permanently uncollapsible range.
For example, ext4 returns false when a folio still has dirty journalled data, btrfs returns false for dirty or writeback folios before extent state release, and NFS may return false while reclaiming filesystem-private folio state.
In such cases, retrying MADV_COLLAPSE after writeback, reclaim or journal progress may succeed. This matches the existing -EAGAIN handling for SCAN_PAGE_DIRTY_OR_WRITEBACK and other transient collapse failures more closely than -EINVAL.
Therefore, map SCAN_PAGE_HAS_PRIVATE to -EAGAIN so userspace receives retryable feedback for this temporary failure path.
---
mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-khugepaged-return-eagain-for-scan_page_has_private-in-madv_collapse +1 -0
@@ -2808,6 +2808,7 @@ static int madvise_collapse_errno(enum scase SCAN_PAGE_LRU :case SCAN_DEL_PAGE_LRU :case SCAN_PAGE_FILLED : +case SCAN_PAGE_HAS_PRIVATE :case SCAN_PAGE_DIRTY_OR_WRITEBACK :return -EAGAIN ;/*
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-check-file-initialization-writes-in-split_huge_page_test.patch mm-damon-sysfs-schemes-fix-double-increment-of-nr_regions.patch selftests-mm-ksm-functional-tests-fix-partial-write-handling.patch