aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swap.c')
-rw-r--r--mm/swap.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/mm/swap.c b/mm/swap.c
index ba2c0e8b8b54..8adb9feb61e1 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -151,6 +151,26 @@ void rotate_reclaimable_page(struct page *page)
151 } 151 }
152} 152}
153 153
154static void update_page_reclaim_stat(struct zone *zone, struct page *page,
155 int file, int rotated)
156{
157 struct zone_reclaim_stat *reclaim_stat = &zone->reclaim_stat;
158 struct zone_reclaim_stat *memcg_reclaim_stat;
159
160 memcg_reclaim_stat = mem_cgroup_get_reclaim_stat_from_page(page);
161
162 reclaim_stat->recent_scanned[file]++;
163 if (rotated)
164 reclaim_stat->recent_rotated[file]++;
165
166 if (!memcg_reclaim_stat)
167 return;
168
169 memcg_reclaim_stat->recent_scanned[file]++;
170 if (rotated)
171 memcg_reclaim_stat->recent_rotated[file]++;
172}
173
154/* 174/*
155 * FIXME: speed this up? 175 * FIXME: speed this up?
156 */ 176 */
@@ -168,10 +188,8 @@ void activate_page(struct page *page)
168 lru += LRU_ACTIVE; 188 lru += LRU_ACTIVE;
169 add_page_to_lru_list(zone, page, lru); 189 add_page_to_lru_list(zone, page, lru);
170 __count_vm_event(PGACTIVATE); 190 __count_vm_event(PGACTIVATE);
171 mem_cgroup_move_lists(page, lru);
172 191
173 zone->recent_rotated[!!file]++; 192 update_page_reclaim_stat(zone, page, !!file, 1);
174 zone->recent_scanned[!!file]++;
175 } 193 }
176 spin_unlock_irq(&zone->lru_lock); 194 spin_unlock_irq(&zone->lru_lock);
177} 195}
@@ -386,12 +404,14 @@ void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru)
386{ 404{
387 int i; 405 int i;
388 struct zone *zone = NULL; 406 struct zone *zone = NULL;
407
389 VM_BUG_ON(is_unevictable_lru(lru)); 408 VM_BUG_ON(is_unevictable_lru(lru));
390 409
391 for (i = 0; i < pagevec_count(pvec); i++) { 410 for (i = 0; i < pagevec_count(pvec); i++) {
392 struct page *page = pvec->pages[i]; 411 struct page *page = pvec->pages[i];
393 struct zone *pagezone = page_zone(page); 412 struct zone *pagezone = page_zone(page);
394 int file; 413 int file;
414 int active;
395 415
396 if (pagezone != zone) { 416 if (pagezone != zone) {
397 if (zone) 417 if (zone)
@@ -403,12 +423,11 @@ void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru)
403 VM_BUG_ON(PageUnevictable(page)); 423 VM_BUG_ON(PageUnevictable(page));
404 VM_BUG_ON(PageLRU(page)); 424 VM_BUG_ON(PageLRU(page));
405 SetPageLRU(page); 425 SetPageLRU(page);
426 active = is_active_lru(lru);
406 file = is_file_lru(lru); 427 file = is_file_lru(lru);
407 zone->recent_scanned[file]++; 428 if (active)
408 if (is_active_lru(lru)) {
409 SetPageActive(page); 429 SetPageActive(page);
410 zone->recent_rotated[file]++; 430 update_page_reclaim_stat(zone, page, file, active);
411 }
412 add_page_to_lru_list(zone, page, lru); 431 add_page_to_lru_list(zone, page, lru);
413 } 432 }
414 if (zone) 433 if (zone)