mm: remove SWAP_AGAIN in ttu
authorMinchan Kim <minchan@kernel.org>
Wed, 3 May 2017 21:54:17 +0000 (14:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 May 2017 22:52:10 +0000 (15:52 -0700)
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

Link: http://lkml.kernel.org/r/1489555493-14659-7-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/rmap.c
mm/vmscan.c

index 45f41d4fa670f855dac04e3d08a378a1978980c2..a3645d029400ee1b93b1a766512459d6103a6289 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1504,13 +1504,10 @@ static int page_mapcount_is_zero(struct page *page)
  * 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 ttu_flags flags)
                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)
index cfd2651966a844921c3795521a1e01414b04aa03..f80a54da5f7f7e41fec9bc8eefc1a0063cf06501 100644 (file)
@@ -1150,8 +1150,6 @@ static unsigned long shrink_page_list(struct list_head *page_list,
                        case SWAP_FAIL:
                                nr_unmap_fail++;
                                goto activate_locked;
-                       case SWAP_AGAIN:
-                               goto keep_locked;
                        case SWAP_SUCCESS:
                                ; /* try to free the page below */
                        }