Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39b5f29a authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

mm: remove vma arg from page_evictable



page_evictable(page, vma) is an irritant: almost all its callers pass
NULL for vma.  Remove the vma arg and use mlocked_vma_newpage(vma, page)
explicitly in the couple of places it's needed.  But in those places we
don't even need page_evictable() itself!  They're dealing with a freshly
allocated anonymous page, which has no "mapping" and cannot be mlocked yet.

Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Acked-by: default avatarMel Gorman <mel@csn.ul.ie>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Cc: Michel Lespinasse <walken@google.com>
Cc: Ying Han <yinghan@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ec4d9f62
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -197,12 +197,8 @@ the pages are also "rescued" from the unevictable list in the process of
freeing them.

page_evictable() also checks for mlocked pages by testing an additional page
flag, PG_mlocked (as wrapped by PageMlocked()).  If the page is NOT mlocked,
and a non-NULL VMA is supplied, page_evictable() will check whether the VMA is
VM_LOCKED via is_mlocked_vma().  is_mlocked_vma() will SetPageMlocked() and
update the appropriate statistics if the vma is VM_LOCKED.  This method allows
efficient "culling" of pages in the fault path that are being faulted in to
VM_LOCKED VMAs.
flag, PG_mlocked (as wrapped by PageMlocked()), which is set when a page is
faulted into a VM_LOCKED vma, or found in a vma being VM_LOCKED.


VMSCAN'S HANDLING OF UNEVICTABLE PAGES
@@ -651,7 +647,7 @@ PAGE RECLAIM IN shrink_*_list()
-------------------------------

shrink_active_list() culls any obviously unevictable pages - i.e.
!page_evictable(page, NULL) - diverting these to the unevictable list.
!page_evictable(page) - diverting these to the unevictable list.
However, shrink_active_list() only sees unevictable pages that made it onto the
active/inactive lru lists.  Note that these pages do not have PageUnevictable
set - otherwise they would be on the unevictable list and shrink_active_list
+1 −1
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
}
#endif

extern int page_evictable(struct page *page, struct vm_area_struct *vma);
extern int page_evictable(struct page *page);
extern void check_move_unevictable_pages(struct page **, int nr_pages);

extern unsigned long scan_unevictable_pages;
+2 −3
Original line number Diff line number Diff line
@@ -168,9 +168,8 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
}

/*
 * Called only in fault path via page_evictable() for a new page
 * to determine if it's being mapped into a LOCKED vma.
 * If so, mark page as mlocked.
 * Called only in fault path, to determine if a new page is being
 * mapped into a LOCKED vma.  If it is, mark page as mlocked.
 */
static inline int mlocked_vma_newpage(struct vm_area_struct *vma,
				    struct page *page)
+1 −1
Original line number Diff line number Diff line
@@ -1586,7 +1586,7 @@ struct page *ksm_does_need_to_copy(struct page *page,
		SetPageSwapBacked(new_page);
		__set_page_locked(new_page);

		if (page_evictable(new_page, vma))
		if (!mlocked_vma_newpage(vma, new_page))
			lru_cache_add_lru(new_page, LRU_ACTIVE_ANON);
		else
			add_page_to_unevictable_list(new_page);
+1 −1
Original line number Diff line number Diff line
@@ -1080,7 +1080,7 @@ void page_add_new_anon_rmap(struct page *page,
	else
		__inc_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES);
	__page_set_anon_rmap(page, vma, address, 1);
	if (page_evictable(page, vma))
	if (!mlocked_vma_newpage(vma, page))
		lru_cache_add_lru(page, LRU_ACTIVE_ANON);
	else
		add_page_to_unevictable_list(page);
Loading