|
@@ -1855,9 +1855,11 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
|
|
|
*
|
|
|
* The downside is that we have to touch page->_refcount against each page.
|
|
|
* But we had to alter page->flags anyway.
|
|
|
+ *
|
|
|
+ * Returns the number of pages moved to the given lru.
|
|
|
*/
|
|
|
|
|
|
-static void move_active_pages_to_lru(struct lruvec *lruvec,
|
|
|
+static unsigned move_active_pages_to_lru(struct lruvec *lruvec,
|
|
|
struct list_head *list,
|
|
|
struct list_head *pages_to_free,
|
|
|
enum lru_list lru)
|
|
@@ -1866,6 +1868,7 @@ static void move_active_pages_to_lru(struct lruvec *lruvec,
|
|
|
unsigned long pgmoved = 0;
|
|
|
struct page *page;
|
|
|
int nr_pages;
|
|
|
+ int nr_moved = 0;
|
|
|
|
|
|
while (!list_empty(list)) {
|
|
|
page = lru_to_page(list);
|
|
@@ -1891,11 +1894,15 @@ static void move_active_pages_to_lru(struct lruvec *lruvec,
|
|
|
spin_lock_irq(&pgdat->lru_lock);
|
|
|
} else
|
|
|
list_add(&page->lru, pages_to_free);
|
|
|
+ } else {
|
|
|
+ nr_moved += nr_pages;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!is_active_lru(lru))
|
|
|
__count_vm_events(PGDEACTIVATE, pgmoved);
|
|
|
+
|
|
|
+ return nr_moved;
|
|
|
}
|
|
|
|
|
|
static void shrink_active_list(unsigned long nr_to_scan,
|
|
@@ -1911,7 +1918,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
|
|
|
LIST_HEAD(l_inactive);
|
|
|
struct page *page;
|
|
|
struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
|
|
|
- unsigned long nr_rotated = 0;
|
|
|
+ unsigned nr_deactivate, nr_activate;
|
|
|
+ unsigned nr_rotated = 0;
|
|
|
isolate_mode_t isolate_mode = 0;
|
|
|
int file = is_file_lru(lru);
|
|
|
struct pglist_data *pgdat = lruvec_pgdat(lruvec);
|
|
@@ -1989,13 +1997,15 @@ static void shrink_active_list(unsigned long nr_to_scan,
|
|
|
*/
|
|
|
reclaim_stat->recent_rotated[file] += nr_rotated;
|
|
|
|
|
|
- move_active_pages_to_lru(lruvec, &l_active, &l_hold, lru);
|
|
|
- move_active_pages_to_lru(lruvec, &l_inactive, &l_hold, lru - LRU_ACTIVE);
|
|
|
+ nr_activate = move_active_pages_to_lru(lruvec, &l_active, &l_hold, lru);
|
|
|
+ nr_deactivate = move_active_pages_to_lru(lruvec, &l_inactive, &l_hold, lru - LRU_ACTIVE);
|
|
|
__mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, -nr_taken);
|
|
|
spin_unlock_irq(&pgdat->lru_lock);
|
|
|
|
|
|
mem_cgroup_uncharge_list(&l_hold);
|
|
|
free_hot_cold_page_list(&l_hold, true);
|
|
|
+ trace_mm_vmscan_lru_shrink_active(pgdat->node_id, nr_taken, nr_activate,
|
|
|
+ nr_deactivate, nr_rotated, sc->priority, file);
|
|
|
}
|
|
|
|
|
|
/*
|