The quilt patch titled Subject: mm-vmscan-try-to-reclaim-swapcache-pages-if-no-swap-space-v6 has been removed from the -mm tree. Its filename was mm-vmscan-try-to-reclaim-swapcache-pages-if-no-swap-space-v6.patch This patch was dropped because it was folded into mm-vmscan-try-to-reclaim-swapcache-pages-if-no-swap-space.patch ------------------------------------------------------ From: Liu Shixin <liushixin2@xxxxxxxxxx> Subject: mm-vmscan-try-to-reclaim-swapcache-pages-if-no-swap-space-v6 Date: Fri, 15 Sep 2023 16:34:17 +0800 fix NULL pointing derefence and hung task problem reported by Sachin Link: https://lkml.kernel.org/r/20230915083417.3190512-1-liushixin2@xxxxxxxxxx Signed-off-by: Liu Shixin <liushixin2@xxxxxxxxxx> Tested-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Reviewed-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Reviewed-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Sachin Sant <sachinp@xxxxxxxxxxxxx> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) --- a/mm/vmscan.c~mm-vmscan-try-to-reclaim-swapcache-pages-if-no-swap-space-v6 +++ a/mm/vmscan.c @@ -324,7 +324,8 @@ static inline bool can_reclaim_anon_page return true; /* Is there any swapcache pages to reclaim? */ if (total_swapcache_pages() > 0) { - sc->swapcache_only = 1; + if (sc) + sc->swapcache_only = 1; return true; } } else { @@ -333,7 +334,8 @@ static inline bool can_reclaim_anon_page return true; /* Is there any swapcache pages in memcg to reclaim? */ if (mem_cgroup_get_nr_swapcache_pages(memcg) > 0) { - sc->swapcache_only = 1; + if (sc) + sc->swapcache_only = 1; return true; } } @@ -1597,19 +1599,6 @@ static bool skip_cma(struct folio *folio } #endif -static bool skip_isolate(struct folio *folio, struct scan_control *sc, - enum lru_list lru) -{ - if (folio_zonenum(folio) > sc->reclaim_idx) - return true; - if (skip_cma(folio, sc)) - return true; - if (unlikely(sc->swapcache_only && !is_file_lru(lru) && - !folio_test_swapcache(folio))) - return true; - return false; -} - /* * Isolating page from the lruvec to fill in @dst list by nr_to_scan times. * @@ -1656,7 +1645,8 @@ static unsigned long isolate_lru_folios( nr_pages = folio_nr_pages(folio); total_scan += nr_pages; - if (skip_isolate(folio, sc, lru)) { + if (folio_zonenum(folio) > sc->reclaim_idx || + skip_cma(folio, sc)) { nr_skipped[folio_zonenum(folio)] += nr_pages; move_to = &folios_skipped; goto move; @@ -1671,6 +1661,15 @@ static unsigned long isolate_lru_folios( */ scan += nr_pages; + /* + * Count non-swapcache too because the swapcache pages may + * be rare and it takes too much times here if not count + * the non-swapcache pages. + */ + if (unlikely(sc->swapcache_only && !is_file_lru(lru) && + !folio_test_swapcache(folio))) + goto move; + if (!folio_test_lru(folio)) goto move; if (!sc->may_unmap && folio_mapped(folio)) _ Patches currently in -mm which might be from liushixin2@xxxxxxxxxx are mm-vmscan-try-to-reclaim-swapcache-pages-if-no-swap-space.patch