aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c59
1 files changed, 1 insertions, 58 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 444749669187..bee53495a829 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -769,64 +769,7 @@ int remove_mapping(struct address_space *mapping, struct page *page)
769 */ 769 */
770void putback_lru_page(struct page *page) 770void putback_lru_page(struct page *page)
771{ 771{
772 bool is_unevictable; 772 lru_cache_add(page);
773 int was_unevictable = PageUnevictable(page);
774
775 VM_BUG_ON_PAGE(PageLRU(page), page);
776
777redo:
778 ClearPageUnevictable(page);
779
780 if (page_evictable(page)) {
781 /*
782 * For evictable pages, we can use the cache.
783 * In event of a race, worst case is we end up with an
784 * unevictable page on [in]active list.
785 * We know how to handle that.
786 */
787 is_unevictable = false;
788 lru_cache_add(page);
789 } else {
790 /*
791 * Put unevictable pages directly on zone's unevictable
792 * list.
793 */
794 is_unevictable = true;
795 add_page_to_unevictable_list(page);
796 /*
797 * When racing with an mlock or AS_UNEVICTABLE clearing
798 * (page is unlocked) make sure that if the other thread
799 * does not observe our setting of PG_lru and fails
800 * isolation/check_move_unevictable_pages,
801 * we see PG_mlocked/AS_UNEVICTABLE cleared below and move
802 * the page back to the evictable list.
803 *
804 * The other side is TestClearPageMlocked() or shmem_lock().
805 */
806 smp_mb();
807 }
808
809 /*
810 * page's status can change while we move it among lru. If an evictable
811 * page is on unevictable list, it never be freed. To avoid that,
812 * check after we added it to the list, again.
813 */
814 if (is_unevictable && page_evictable(page)) {
815 if (!isolate_lru_page(page)) {
816 put_page(page);
817 goto redo;
818 }
819 /* This means someone else dropped this page from LRU
820 * So, it will be freed or putback to LRU again. There is
821 * nothing to do here.
822 */
823 }
824
825 if (was_unevictable && !is_unevictable)
826 count_vm_event(UNEVICTABLE_PGRESCUED);
827 else if (!was_unevictable && is_unevictable)
828 count_vm_event(UNEVICTABLE_PGCULLED);
829
830 put_page(page); /* drop ref from isolate */ 773 put_page(page); /* drop ref from isolate */
831} 774}
832 775