Skip to contentSkip to conversation

mm: remove SWAP_AGAIN in ttu

PATCH New [email protected] 1 participant 1 message May 3, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 53/102 mm: remove SWAP_AGAIN in ttu

From: Minchan Kim <[email protected]>
Subject: mm: remove SWAP_AGAIN in ttu

In 2002, [1] introduced SWAP_AGAIN. At that time, try_to_unmap_one used spin_trylock(&mm->page_table_lock) so it's really easy to contend and fail to hold a lock so SWAP_AGAIN to keep LRU status makes sense.

However, now we changed it to mutex-based lock and be able to block without skip pte so there is few of small window to return SWAP_AGAIN so remove SWAP_AGAIN and just return SWAP_FAIL.

[1] c48c43e, minimal rmap

Cc Anshuman Khandual <[email protected]>
Cc Hillf Danton <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Naoya Horiguchi <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 mm/rmap.c   |   11 +++--------
 mm/vmscan.c |    2 --
 2 files changed, 3 insertions(+), 10 deletions(-)
mm/rmap.c renamed from mm/rmap.c~mm-remove-swap_again-in-ttu +3 -8
diff -puN mm/rmap.c~mm-remove-swap_again-in-ttu mm/rmap.c
@@ -1504,13 +1504,10 @@ static int page_mapcount_is_zero(struct
  * Return values are:
  *
  * SWAP_SUCCESS	- we succeeded in removing all mappings
- * SWAP_AGAIN	- we missed a mapping, try again later
  * SWAP_FAIL	- the page is unswappable
  */
 int try_to_unmap(struct page *page, enum ttu_flags flags)
 {
-	int ret;
-
 	struct rmap_walk_control rwc = {
 		.rmap_one = try_to_unmap_one,
 		.arg = (void *)flags,
@@ -1530,13 +1527,11 @@ int try_to_unmap(struct page *page, enum
 		rwc.invalid_vma = invalid_migration_vma;
 
 	if (flags & TTU_RMAP_LOCKED)
-		ret = rmap_walk_locked(page, &rwc);
+		rmap_walk_locked(page, &rwc);
 	else
-		ret = rmap_walk(page, &rwc);
+		rmap_walk(page, &rwc);
 
-	if (!page_mapcount(page))
-		ret = SWAP_SUCCESS;
-	return ret;
+	return !page_mapcount(page) ? SWAP_SUCCESS : SWAP_FAIL;
 }
 
 static int page_not_mapped(struct page *page)
mm/vmscan.c renamed from mm/vmscan.c~mm-remove-swap_again-in-ttu +0 -2
diff -puN mm/vmscan.c~mm-remove-swap_again-in-ttu mm/vmscan.c
@@ -1150,8 +1150,6 @@ static unsigned long shrink_page_list(st
 			case SWAP_FAIL:
 				nr_unmap_fail++;
 				goto activate_locked;
-			case SWAP_AGAIN:
-				goto keep_locked;
 			case SWAP_SUCCESS:
 				; /* try to free the page below */
 			}

_