diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 26 | ||||
-rw-r--r-- | mm/swap.c | 3 |
2 files changed, 28 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6ef5c53dffcb..9e0f05efd114 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -829,6 +829,32 @@ void mem_cgroup_del_lru(struct page *page) | |||
829 | mem_cgroup_del_lru_list(page, page_lru(page)); | 829 | mem_cgroup_del_lru_list(page, page_lru(page)); |
830 | } | 830 | } |
831 | 831 | ||
832 | /* | ||
833 | * Writeback is about to end against a page which has been marked for immediate | ||
834 | * reclaim. If it still appears to be reclaimable, move it to the tail of the | ||
835 | * inactive list. | ||
836 | */ | ||
837 | void mem_cgroup_rotate_reclaimable_page(struct page *page) | ||
838 | { | ||
839 | struct mem_cgroup_per_zone *mz; | ||
840 | struct page_cgroup *pc; | ||
841 | enum lru_list lru = page_lru(page); | ||
842 | |||
843 | if (mem_cgroup_disabled()) | ||
844 | return; | ||
845 | |||
846 | pc = lookup_page_cgroup(page); | ||
847 | /* unused or root page is not rotated. */ | ||
848 | if (!PageCgroupUsed(pc)) | ||
849 | return; | ||
850 | /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */ | ||
851 | smp_rmb(); | ||
852 | if (mem_cgroup_is_root(pc->mem_cgroup)) | ||
853 | return; | ||
854 | mz = page_cgroup_zoneinfo(pc); | ||
855 | list_move_tail(&pc->lru, &mz->lists[lru]); | ||
856 | } | ||
857 | |||
832 | void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru) | 858 | void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru) |
833 | { | 859 | { |
834 | struct mem_cgroup_per_zone *mz; | 860 | struct mem_cgroup_per_zone *mz; |
@@ -200,8 +200,9 @@ static void pagevec_move_tail(struct pagevec *pvec) | |||
200 | spin_lock(&zone->lru_lock); | 200 | spin_lock(&zone->lru_lock); |
201 | } | 201 | } |
202 | if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) { | 202 | if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) { |
203 | int lru = page_lru_base_type(page); | 203 | enum lru_list lru = page_lru_base_type(page); |
204 | list_move_tail(&page->lru, &zone->lru[lru].list); | 204 | list_move_tail(&page->lru, &zone->lru[lru].list); |
205 | mem_cgroup_rotate_reclaimable_page(page); | ||
205 | pgmoved++; | 206 | pgmoved++; |
206 | } | 207 | } |
207 | } | 208 | } |