vmscan.c (e5146b12e2d02af04608301c958d95b2fc47a0f9) | vmscan.c (7cc30fcfd2a894589d832a192cac3dc5cd302bb8) |
---|---|
1/* 2 * linux/mm/vmscan.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * 6 * Swap reorganised 29.12.95, Stephen Tweedie. 7 * kswapd added: 7.1.96 sct 8 * Removed kswapd_ctl limits, and swap out as many pages as needed --- 1380 unchanged lines hidden (view full) --- 1389static unsigned long isolate_lru_pages(unsigned long nr_to_scan, 1390 struct lruvec *lruvec, struct list_head *dst, 1391 unsigned long *nr_scanned, struct scan_control *sc, 1392 isolate_mode_t mode, enum lru_list lru) 1393{ 1394 struct list_head *src = &lruvec->lists[lru]; 1395 unsigned long nr_taken = 0; 1396 unsigned long nr_zone_taken[MAX_NR_ZONES] = { 0 }; | 1/* 2 * linux/mm/vmscan.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * 6 * Swap reorganised 29.12.95, Stephen Tweedie. 7 * kswapd added: 7.1.96 sct 8 * Removed kswapd_ctl limits, and swap out as many pages as needed --- 1380 unchanged lines hidden (view full) --- 1389static unsigned long isolate_lru_pages(unsigned long nr_to_scan, 1390 struct lruvec *lruvec, struct list_head *dst, 1391 unsigned long *nr_scanned, struct scan_control *sc, 1392 isolate_mode_t mode, enum lru_list lru) 1393{ 1394 struct list_head *src = &lruvec->lists[lru]; 1395 unsigned long nr_taken = 0; 1396 unsigned long nr_zone_taken[MAX_NR_ZONES] = { 0 }; |
1397 unsigned long nr_skipped[MAX_NR_ZONES] = { 0, }; |
|
1397 unsigned long scan, nr_pages; 1398 LIST_HEAD(pages_skipped); 1399 1400 for (scan = 0; scan < nr_to_scan && nr_taken < nr_to_scan && 1401 !list_empty(src); scan++) { 1402 struct page *page; 1403 1404 page = lru_to_page(src); 1405 prefetchw_prev_lru_page(page, src, flags); 1406 1407 VM_BUG_ON_PAGE(!PageLRU(page), page); 1408 1409 if (page_zonenum(page) > sc->reclaim_idx) { 1410 list_move(&page->lru, &pages_skipped); | 1398 unsigned long scan, nr_pages; 1399 LIST_HEAD(pages_skipped); 1400 1401 for (scan = 0; scan < nr_to_scan && nr_taken < nr_to_scan && 1402 !list_empty(src); scan++) { 1403 struct page *page; 1404 1405 page = lru_to_page(src); 1406 prefetchw_prev_lru_page(page, src, flags); 1407 1408 VM_BUG_ON_PAGE(!PageLRU(page), page); 1409 1410 if (page_zonenum(page) > sc->reclaim_idx) { 1411 list_move(&page->lru, &pages_skipped); |
1412 nr_skipped[page_zonenum(page)]++; |
|
1411 continue; 1412 } 1413 1414 switch (__isolate_lru_page(page, mode)) { 1415 case 0: 1416 nr_pages = hpage_nr_pages(page); 1417 nr_taken += nr_pages; 1418 nr_zone_taken[page_zonenum(page)] += nr_pages; --- 12 unchanged lines hidden (view full) --- 1431 1432 /* 1433 * Splice any skipped pages to the start of the LRU list. Note that 1434 * this disrupts the LRU order when reclaiming for lower zones but 1435 * we cannot splice to the tail. If we did then the SWAP_CLUSTER_MAX 1436 * scanning would soon rescan the same pages to skip and put the 1437 * system at risk of premature OOM. 1438 */ | 1413 continue; 1414 } 1415 1416 switch (__isolate_lru_page(page, mode)) { 1417 case 0: 1418 nr_pages = hpage_nr_pages(page); 1419 nr_taken += nr_pages; 1420 nr_zone_taken[page_zonenum(page)] += nr_pages; --- 12 unchanged lines hidden (view full) --- 1433 1434 /* 1435 * Splice any skipped pages to the start of the LRU list. Note that 1436 * this disrupts the LRU order when reclaiming for lower zones but 1437 * we cannot splice to the tail. If we did then the SWAP_CLUSTER_MAX 1438 * scanning would soon rescan the same pages to skip and put the 1439 * system at risk of premature OOM. 1440 */ |
1439 if (!list_empty(&pages_skipped)) | 1441 if (!list_empty(&pages_skipped)) { 1442 int zid; 1443 |
1440 list_splice(&pages_skipped, src); | 1444 list_splice(&pages_skipped, src); |
1445 for (zid = 0; zid < MAX_NR_ZONES; zid++) { 1446 if (!nr_skipped[zid]) 1447 continue; 1448 1449 __count_zid_vm_events(PGSCAN_SKIP, zid, nr_skipped[zid]); 1450 } 1451 } |
|
1441 *nr_scanned = scan; 1442 trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, nr_to_scan, scan, 1443 nr_taken, mode, is_file_lru(lru)); 1444 for (scan = 0; scan < MAX_NR_ZONES; scan++) { 1445 nr_pages = nr_zone_taken[scan]; 1446 if (!nr_pages) 1447 continue; 1448 --- 1226 unchanged lines hidden (view full) --- 2675{ 2676 int initial_priority = sc->priority; 2677 unsigned long total_scanned = 0; 2678 unsigned long writeback_threshold; 2679retry: 2680 delayacct_freepages_start(); 2681 2682 if (global_reclaim(sc)) | 1452 *nr_scanned = scan; 1453 trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, nr_to_scan, scan, 1454 nr_taken, mode, is_file_lru(lru)); 1455 for (scan = 0; scan < MAX_NR_ZONES; scan++) { 1456 nr_pages = nr_zone_taken[scan]; 1457 if (!nr_pages) 1458 continue; 1459 --- 1226 unchanged lines hidden (view full) --- 2686{ 2687 int initial_priority = sc->priority; 2688 unsigned long total_scanned = 0; 2689 unsigned long writeback_threshold; 2690retry: 2691 delayacct_freepages_start(); 2692 2693 if (global_reclaim(sc)) |
2683 count_vm_event(ALLOCSTALL); | 2694 __count_zid_vm_events(ALLOCSTALL, sc->reclaim_idx, 1); |
2684 2685 do { 2686 vmpressure_prio(sc->gfp_mask, sc->target_mem_cgroup, 2687 sc->priority); 2688 sc->nr_scanned = 0; 2689 shrink_zones(zonelist, sc); 2690 2691 total_scanned += sc->nr_scanned; --- 1107 unchanged lines hidden --- | 2695 2696 do { 2697 vmpressure_prio(sc->gfp_mask, sc->target_mem_cgroup, 2698 sc->priority); 2699 sc->nr_scanned = 0; 2700 shrink_zones(zonelist, sc); 2701 2702 total_scanned += sc->nr_scanned; --- 1107 unchanged lines hidden --- |