Commit f626012db08b9ea71363327d81fe60c2782eea9f

Authored by Hugh Dickins
Committed by Linus Torvalds
1 parent 1c1c53d43b

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>

Showing 1 changed file with 27 additions and 34 deletions Side-by-side Diff

... ... @@ -1136,26 +1136,37 @@
1136 1136 * Appropriate locks must be held before calling this function.
1137 1137 *
1138 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 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 1142 * @order: The caller's attempted allocation order
1143 1143 * @mode: One of the LRU isolation modes
  1144 + * @active: True [1] if isolating active pages
1144 1145 * @file: True [1] if isolating file [!anon] pages
1145 1146 *
1146 1147 * returns how many pages were moved onto *@dst.
1147 1148 */
1148 1149 static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
1149   - struct list_head *src, struct list_head *dst,
1150   - unsigned long *scanned, int order, isolate_mode_t mode,
1151   - int file)
  1150 + struct mem_cgroup_zone *mz, struct list_head *dst,
  1151 + unsigned long *nr_scanned, int order, isolate_mode_t mode,
  1152 + int active, int file)
1152 1153 {
  1154 + struct lruvec *lruvec;
  1155 + struct list_head *src;
1153 1156 unsigned long nr_taken = 0;
1154 1157 unsigned long nr_lumpy_taken = 0;
1155 1158 unsigned long nr_lumpy_dirty = 0;
1156 1159 unsigned long nr_lumpy_failed = 0;
1157 1160 unsigned long scan;
  1161 + int lru = LRU_BASE;
1158 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];
  1169 +
1159 1170 for (scan = 0; scan < nr_to_scan && !list_empty(src); scan++) {
1160 1171 struct page *page;
1161 1172 unsigned long pfn;
... ... @@ -1263,7 +1274,7 @@
1263 1274 nr_lumpy_failed++;
1264 1275 }
1265 1276  
1266   - *scanned = scan;
  1277 + *nr_scanned = scan;
1267 1278  
1268 1279 trace_mm_vmscan_lru_isolate(order,
1269 1280 nr_to_scan, scan,
... ... @@ -1273,23 +1284,6 @@
1273 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 1288 * clear_active_flags() is a helper for shrink_active_list(), clearing
1295 1289 * any active bits from the pages in the list.
... ... @@ -1559,9 +1553,9 @@
1559 1553  
1560 1554 spin_lock_irq(&zone->lru_lock);
1561 1555  
1562   - nr_taken = isolate_pages(nr_to_scan, mz, &page_list,
1563   - &nr_scanned, sc->order,
1564   - reclaim_mode, 0, file);
  1556 + nr_taken = isolate_lru_pages(nr_to_scan, mz, &page_list,
  1557 + &nr_scanned, sc->order,
  1558 + reclaim_mode, 0, file);
1565 1559 if (global_reclaim(sc)) {
1566 1560 zone->pages_scanned += nr_scanned;
1567 1561 if (current_is_kswapd())
1568 1562  
... ... @@ -1700,13 +1694,13 @@
1700 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 1698 struct mem_cgroup_zone *mz,
1705 1699 struct scan_control *sc,
1706 1700 int priority, int file)
1707 1701 {
1708 1702 unsigned long nr_taken;
1709   - unsigned long pgscanned;
  1703 + unsigned long nr_scanned;
1710 1704 unsigned long vm_flags;
1711 1705 LIST_HEAD(l_hold); /* The pages which were snipped off */
1712 1706 LIST_HEAD(l_active);
1713 1707  
1714 1708  
... ... @@ -1726,16 +1720,15 @@
1726 1720  
1727 1721 spin_lock_irq(&zone->lru_lock);
1728 1722  
1729   - nr_taken = isolate_pages(nr_pages, mz, &l_hold,
1730   - &pgscanned, sc->order,
1731   - reclaim_mode, 1, file);
1732   -
  1723 + nr_taken = isolate_lru_pages(nr_to_scan, mz, &l_hold,
  1724 + &nr_scanned, sc->order,
  1725 + reclaim_mode, 1, file);
1733 1726 if (global_reclaim(sc))
1734   - zone->pages_scanned += pgscanned;
  1727 + zone->pages_scanned += nr_scanned;
1735 1728  
1736 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 1732 if (file)
1740 1733 __mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken);
1741 1734 else