summaryrefslogtreecommitdiff
path: root/mm/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swap.c')
-rw-r--r--mm/swap.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/mm/swap.c b/mm/swap.c
index 4dff2123f695..343675d629ae 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -278,18 +278,16 @@ void rotate_reclaimable_page(struct page *page)
}
}
-void lru_note_cost(struct page *page)
+void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
{
- struct lruvec *lruvec = mem_cgroup_page_lruvec(page, page_pgdat(page));
-
do {
unsigned long lrusize;
/* Record cost event */
- if (page_is_file_lru(page))
- lruvec->file_cost++;
+ if (file)
+ lruvec->file_cost += nr_pages;
else
- lruvec->anon_cost++;
+ lruvec->anon_cost += nr_pages;
/*
* Decay previous events
@@ -311,6 +309,12 @@ void lru_note_cost(struct page *page)
} while ((lruvec = parent_lruvec(lruvec)));
}
+void lru_note_cost_page(struct page *page)
+{
+ lru_note_cost(mem_cgroup_page_lruvec(page, page_pgdat(page)),
+ page_is_file_lru(page), hpage_nr_pages(page));
+}
+
static void __activate_page(struct page *page, struct lruvec *lruvec,
void *arg)
{