mm-madvise-madv_collapse-return-eagain-when-page-cannot-be-isolated.patch removed from -mm tree
The quilt patch titled
Subject: mm/madvise: MADV_COLLAPSE return EAGAIN when page cannot be isolated
has been removed from the -mm tree. Its filename was
mm-madvise-madv_collapse-return-eagain-when-page-cannot-be-isolated.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: "Zach O'Keefe" <[email protected]>
Subject: mm/madvise: MADV_COLLAPSE return EAGAIN when page cannot be isolated
Date: Thu, 22 Sep 2022 11:46:50 -0700
MADV_COLLAPSE is a best-effort request that attempts to set an actionable errno value if the request cannot be fulfilled at the time. EAGAIN should be used to communicate that a resource was temporarily unavailable, but that the user may try again immediately.
SCAN_DEL_PAGE_LRU is an internal result code used when a page cannot be isolated from it's LRU list. Since this, like SCAN_PAGE_LRU, is likely a transitory state, make MADV_COLLAPSE return EAGAIN so that users know they may reattempt the operation.
Another important scenario to consider is race with khugepaged. khugepaged might isolate a page while MADV_COLLAPSE is interested in it. Even though racing with khugepaged might mean that the memory has already been collapsed, signalling an errno that is non-intrinsic to that memory or arguments provided to madvise(2) lets the user know that future attempts might (and in this case likely would) succeed, and avoids false-negative assumptions by the user.
---
mm/khugepaged.c | 2 ++ 1 file changed, 2 insertions(+)
mm/khugepaged.c renamed from mm/khugepaged.c~mm-madvise-madv_collapse-return-eagain-when-page-cannot-be-isolated +2 -0
@@ -2372,6 +2372,7 @@ static int madvise_collapse_errno(enum s/* Resource temporary unavailable - trying again might succeed */ case SCAN_PAGE_LOCK :case SCAN_PAGE_LRU : +case SCAN_DEL_PAGE_LRU :return -EAGAIN ;/* * Other: Trying again likely not to succeed / error intrinsic to
@@ -2454,6 +2455,7 @@ int madvise_collapse(struct vm_area_strucase SCAN_PAGE_LOCK :case SCAN_PAGE_COMPOUND :case SCAN_PAGE_LRU : +case SCAN_DEL_PAGE_LRU : last_fail = result;break ;default :
_
Patches currently in -mm which might be from [email protected] are