diff options
author | Hugh Dickins <hughd@google.com> | 2012-01-12 20:20:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:10 -0500 |
commit | f626012db08b9ea71363327d81fe60c2782eea9f (patch) | |
tree | 3171843ead87fc7a3a959be802638205a473da56 | |
parent | 1c1c53d43b387d02174911ecb42ce846577b0ea0 (diff) |
mm: remove isolate_pages()
The isolate_pages() level in vmscan.c offers little but indirection: merge
it into isolate_lru_pages() as the compiler does, and use the names
nr_to_scan and nr_scanned in each case.
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/vmscan.c | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 01466bf783fd..9aab5dc51718 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1136,25 +1136,36 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file) | |||
1136 | * Appropriate locks must be held before calling this function. | 1136 | * Appropriate locks must be held before calling this function. |
1137 | * | 1137 | * |
1138 | * @nr_to_scan: The number of pages to look through on the list. | 1138 | * @nr_to_scan: The number of pages to look through on the list. |
1139 | * @src: The LRU list to pull pages off. | 1139 | * @mz: The mem_cgroup_zone to pull pages from. |
1140 | * @dst: The temp list to put pages on to. | 1140 | * @dst: The temp list to put pages on to. |
1141 | * @scanned: The number of pages that were scanned. | 1141 | * @nr_scanned: The number of pages that were scanned. |
1142 | * @order: The caller's attempted allocation order | 1142 | * @order: The caller's attempted allocation order |
1143 | * @mode: One of the LRU isolation modes | 1143 | * @mode: One of the LRU isolation modes |
1144 | * @active: True [1] if isolating active pages | ||
1144 | * @file: True [1] if isolating file [!anon] pages | 1145 | * @file: True [1] if isolating file [!anon] pages |
1145 | * | 1146 | * |
1146 | * returns how many pages were moved onto *@dst. | 1147 | * returns how many pages were moved onto *@dst. |
1147 | */ | 1148 | */ |
1148 | static unsigned long isolate_lru_pages(unsigned long nr_to_scan, | 1149 | static unsigned long isolate_lru_pages(unsigned long nr_to_scan, |
1149 | struct list_head *src, struct list_head *dst, | 1150 | struct mem_cgroup_zone *mz, struct list_head *dst, |
1150 | unsigned long *scanned, int order, isolate_mode_t mode, | 1151 | unsigned long *nr_scanned, int order, isolate_mode_t mode, |
1151 | int file) | 1152 | int active, int file) |
1152 | { | 1153 | { |
1154 | struct lruvec *lruvec; | ||
1155 | struct list_head *src; | ||
1153 | unsigned long nr_taken = 0; | 1156 | unsigned long nr_taken = 0; |
1154 | unsigned long nr_lumpy_taken = 0; | 1157 | unsigned long nr_lumpy_taken = 0; |
1155 | unsigned long nr_lumpy_dirty = 0; | 1158 | unsigned long nr_lumpy_dirty = 0; |
1156 | unsigned long nr_lumpy_failed = 0; | 1159 | unsigned long nr_lumpy_failed = 0; |
1157 | unsigned long scan; | 1160 | unsigned long scan; |
1161 | int lru = LRU_BASE; | ||
1162 | |||
1163 | lruvec = mem_cgroup_zone_lruvec(mz->zone, mz->mem_cgroup); | ||
1164 | if (active) | ||
1165 | lru += LRU_ACTIVE; | ||
1166 | if (file) | ||
1167 | lru += LRU_FILE; | ||
1168 | src = &lruvec->lists[lru]; | ||
1158 | 1169 | ||
1159 | for (scan = 0; scan < nr_to_scan && !list_empty(src); scan++) { | 1170 | for (scan = 0; scan < nr_to_scan && !list_empty(src); scan++) { |
1160 | struct page *page; | 1171 | struct page *page; |
@@ -1263,7 +1274,7 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan, | |||
1263 | nr_lumpy_failed++; | 1274 | nr_lumpy_failed++; |
1264 | } | 1275 | } |
1265 | 1276 | ||
1266 | *scanned = scan; | 1277 | *nr_scanned = scan; |
1267 | 1278 | ||
1268 | trace_mm_vmscan_lru_isolate(order, | 1279 | trace_mm_vmscan_lru_isolate(order, |
1269 | nr_to_scan, scan, | 1280 | nr_to_scan, scan, |
@@ -1273,23 +1284,6 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan, | |||
1273 | return nr_taken; | 1284 | return nr_taken; |
1274 | } | 1285 | } |
1275 | 1286 | ||
1276 | static unsigned long isolate_pages(unsigned long nr, struct mem_cgroup_zone *mz, | ||
1277 | struct list_head *dst, | ||
1278 | unsigned long *scanned, int order, | ||
1279 | isolate_mode_t mode, int active, int file) | ||
1280 | { | ||
1281 | struct lruvec *lruvec; | ||
1282 | int lru = LRU_BASE; | ||
1283 | |||
1284 | lruvec = mem_cgroup_zone_lruvec(mz->zone, mz->mem_cgroup); | ||
1285 | if (active) | ||
1286 | lru += LRU_ACTIVE; | ||
1287 | if (file) | ||
1288 | lru += LRU_FILE; | ||
1289 | return isolate_lru_pages(nr, &lruvec->lists[lru], dst, | ||
1290 | scanned, order, mode, file); | ||
1291 | } | ||
1292 | |||
1293 | /* | 1287 | /* |
1294 | * clear_active_flags() is a helper for shrink_active_list(), clearing | 1288 | * clear_active_flags() is a helper for shrink_active_list(), clearing |
1295 | * any active bits from the pages in the list. | 1289 | * any active bits from the pages in the list. |
@@ -1559,9 +1553,9 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz, | |||
1559 | 1553 | ||
1560 | spin_lock_irq(&zone->lru_lock); | 1554 | spin_lock_irq(&zone->lru_lock); |
1561 | 1555 | ||
1562 | nr_taken = isolate_pages(nr_to_scan, mz, &page_list, | 1556 | nr_taken = isolate_lru_pages(nr_to_scan, mz, &page_list, |
1563 | &nr_scanned, sc->order, | 1557 | &nr_scanned, sc->order, |
1564 | reclaim_mode, 0, file); | 1558 | reclaim_mode, 0, file); |
1565 | if (global_reclaim(sc)) { | 1559 | if (global_reclaim(sc)) { |
1566 | zone->pages_scanned += nr_scanned; | 1560 | zone->pages_scanned += nr_scanned; |
1567 | if (current_is_kswapd()) | 1561 | if (current_is_kswapd()) |
@@ -1700,13 +1694,13 @@ static void move_active_pages_to_lru(struct zone *zone, | |||
1700 | __count_vm_events(PGDEACTIVATE, pgmoved); | 1694 | __count_vm_events(PGDEACTIVATE, pgmoved); |
1701 | } | 1695 | } |
1702 | 1696 | ||
1703 | static void shrink_active_list(unsigned long nr_pages, | 1697 | static void shrink_active_list(unsigned long nr_to_scan, |
1704 | struct mem_cgroup_zone *mz, | 1698 | struct mem_cgroup_zone *mz, |
1705 | struct scan_control *sc, | 1699 | struct scan_control *sc, |
1706 | int priority, int file) | 1700 | int priority, int file) |
1707 | { | 1701 | { |
1708 | unsigned long nr_taken; | 1702 | unsigned long nr_taken; |
1709 | unsigned long pgscanned; | 1703 | unsigned long nr_scanned; |
1710 | unsigned long vm_flags; | 1704 | unsigned long vm_flags; |
1711 | LIST_HEAD(l_hold); /* The pages which were snipped off */ | 1705 | LIST_HEAD(l_hold); /* The pages which were snipped off */ |
1712 | LIST_HEAD(l_active); | 1706 | LIST_HEAD(l_active); |
@@ -1726,16 +1720,15 @@ static void shrink_active_list(unsigned long nr_pages, | |||
1726 | 1720 | ||
1727 | spin_lock_irq(&zone->lru_lock); | 1721 | spin_lock_irq(&zone->lru_lock); |
1728 | 1722 | ||
1729 | nr_taken = isolate_pages(nr_pages, mz, &l_hold, | 1723 | nr_taken = isolate_lru_pages(nr_to_scan, mz, &l_hold, |
1730 | &pgscanned, sc->order, | 1724 | &nr_scanned, sc->order, |
1731 | reclaim_mode, 1, file); | 1725 | reclaim_mode, 1, file); |
1732 | |||
1733 | if (global_reclaim(sc)) | 1726 | if (global_reclaim(sc)) |
1734 | zone->pages_scanned += pgscanned; | 1727 | zone->pages_scanned += nr_scanned; |
1735 | 1728 | ||
1736 | reclaim_stat->recent_scanned[file] += nr_taken; | 1729 | reclaim_stat->recent_scanned[file] += nr_taken; |
1737 | 1730 | ||
1738 | __count_zone_vm_events(PGREFILL, zone, pgscanned); | 1731 | __count_zone_vm_events(PGREFILL, zone, nr_scanned); |
1739 | if (file) | 1732 | if (file) |
1740 | __mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken); | 1733 | __mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken); |
1741 | else | 1734 | else |