vmscan.c (e33c267ab70de4249d22d7eab1cc7d68a889bac2) | vmscan.c (b8cecb9376b9d3031cf62b476a0db087b6b01072) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 4 * 5 * Swap reorganised 29.12.95, Stephen Tweedie. 6 * kswapd added: 7.1.96 sct 7 * Removed kswapd_ctl limits, and swap out as many pages as needed 8 * to bring the system back to freepages.high: 2.4.97, Rik van Riel. --- 2027 unchanged lines hidden (view full) --- 2036 count_vm_events(PGACTIVATE, pgactivate); 2037 2038 if (plug) 2039 swap_write_unplug(plug); 2040 return nr_reclaimed; 2041} 2042 2043unsigned int reclaim_clean_pages_from_list(struct zone *zone, | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 4 * 5 * Swap reorganised 29.12.95, Stephen Tweedie. 6 * kswapd added: 7.1.96 sct 7 * Removed kswapd_ctl limits, and swap out as many pages as needed 8 * to bring the system back to freepages.high: 2.4.97, Rik van Riel. --- 2027 unchanged lines hidden (view full) --- 2036 count_vm_events(PGACTIVATE, pgactivate); 2037 2038 if (plug) 2039 swap_write_unplug(plug); 2040 return nr_reclaimed; 2041} 2042 2043unsigned int reclaim_clean_pages_from_list(struct zone *zone, |
2044 struct list_head *page_list) | 2044 struct list_head *folio_list) |
2045{ 2046 struct scan_control sc = { 2047 .gfp_mask = GFP_KERNEL, 2048 .may_unmap = 1, 2049 }; 2050 struct reclaim_stat stat; 2051 unsigned int nr_reclaimed; | 2045{ 2046 struct scan_control sc = { 2047 .gfp_mask = GFP_KERNEL, 2048 .may_unmap = 1, 2049 }; 2050 struct reclaim_stat stat; 2051 unsigned int nr_reclaimed; |
2052 struct page *page, *next; 2053 LIST_HEAD(clean_pages); | 2052 struct folio *folio, *next; 2053 LIST_HEAD(clean_folios); |
2054 unsigned int noreclaim_flag; 2055 | 2054 unsigned int noreclaim_flag; 2055 |
2056 list_for_each_entry_safe(page, next, page_list, lru) { 2057 if (!PageHuge(page) && page_is_file_lru(page) && 2058 !PageDirty(page) && !__PageMovable(page) && 2059 !PageUnevictable(page)) { 2060 ClearPageActive(page); 2061 list_move(&page->lru, &clean_pages); | 2056 list_for_each_entry_safe(folio, next, folio_list, lru) { 2057 if (!folio_test_hugetlb(folio) && folio_is_file_lru(folio) && 2058 !folio_test_dirty(folio) && !__folio_test_movable(folio) && 2059 !folio_test_unevictable(folio)) { 2060 folio_clear_active(folio); 2061 list_move(&folio->lru, &clean_folios); |
2062 } 2063 } 2064 2065 /* 2066 * We should be safe here since we are only dealing with file pages and 2067 * we are not kswapd and therefore cannot write dirty file pages. But 2068 * call memalloc_noreclaim_save() anyway, just in case these conditions 2069 * change in the future. 2070 */ 2071 noreclaim_flag = memalloc_noreclaim_save(); | 2062 } 2063 } 2064 2065 /* 2066 * We should be safe here since we are only dealing with file pages and 2067 * we are not kswapd and therefore cannot write dirty file pages. But 2068 * call memalloc_noreclaim_save() anyway, just in case these conditions 2069 * change in the future. 2070 */ 2071 noreclaim_flag = memalloc_noreclaim_save(); |
2072 nr_reclaimed = shrink_page_list(&clean_pages, zone->zone_pgdat, &sc, | 2072 nr_reclaimed = shrink_page_list(&clean_folios, zone->zone_pgdat, &sc, |
2073 &stat, true); 2074 memalloc_noreclaim_restore(noreclaim_flag); 2075 | 2073 &stat, true); 2074 memalloc_noreclaim_restore(noreclaim_flag); 2075 |
2076 list_splice(&clean_pages, page_list); | 2076 list_splice(&clean_folios, folio_list); |
2077 mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, 2078 -(long)nr_reclaimed); 2079 /* 2080 * Since lazyfree pages are isolated from file LRU from the beginning, 2081 * they will rotate back to anonymous LRU in the end if it failed to 2082 * discard so isolated count will be mismatched. 2083 * Compensate the isolated count for both LRU lists. 2084 */ --- 2812 unchanged lines hidden --- | 2077 mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, 2078 -(long)nr_reclaimed); 2079 /* 2080 * Since lazyfree pages are isolated from file LRU from the beginning, 2081 * they will rotate back to anonymous LRU in the end if it failed to 2082 * discard so isolated count will be mismatched. 2083 * Compensate the isolated count for both LRU lists. 2084 */ --- 2812 unchanged lines hidden --- |