linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount
@ 2023-01-25  1:57 Zach O'Keefe
  2023-01-25  1:57 ` [PATCH 2/2] mm/MADV_COLLAPSE: catch !none !huge !bad pmd lookups Zach O'Keefe
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Zach O'Keefe @ 2023-01-25  1:57 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Andrew Morton, Hugh Dickins, Yang Shi, Zach O'Keefe

During collapse, in a few places we check to see if a given small page
has any unaccounted references.  If the refcount on the page doesn't
match our expectations, it must be there is an unknown user concurrently
interested in the page, and so it's not safe to move the contents
elsewhere. However, the unaccounted pins are likely an ephemeral state.

In such a situation, make MADV_COLLAPSE set EAGAIN errno, indicating that
collapse may succeed on retry.

Fixes: 7d8faaf15545 ("mm/madvise: introduce MADV_COLLAPSE sync hugepage collapse")
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Zach O'Keefe <zokeefe@google.com>

---
 mm/khugepaged.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index e23619bfecc4..fa38cae240b9 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2712,6 +2712,7 @@ static int madvise_collapse_errno(enum scan_result r)
 	case SCAN_CGROUP_CHARGE_FAIL:
 		return -EBUSY;
 	/* Resource temporary unavailable - trying again might succeed */
+	case SCAN_PAGE_COUNT:
 	case SCAN_PAGE_LOCK:
 	case SCAN_PAGE_LRU:
 	case SCAN_DEL_PAGE_LRU:
-- 
2.39.1.405.gd4c25cc71f-goog



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-02-09 22:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25  1:57 [PATCH 1/2] mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount Zach O'Keefe
2023-01-25  1:57 ` [PATCH 2/2] mm/MADV_COLLAPSE: catch !none !huge !bad pmd lookups Zach O'Keefe
2023-01-25 12:54   ` kernel test robot
2023-01-25 13:38   ` kernel test robot
2023-01-25 18:06 ` [PATCH 1/2] mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount Yang Shi
2023-01-25 19:15   ` Zach O'Keefe
2023-02-09  5:09 ` Hugh Dickins
2023-02-09 21:28   ` Andrew Morton
2023-02-09 21:50     ` Hugh Dickins
2023-02-09 22:12       ` Andrew Morton
2023-02-09 22:29         ` Zach O'Keefe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox