#author("2025-09-11T17:09:39+09:00","default:guest","guest") #author("2025-09-11T17:36:09+09:00","default:guest","guest") *参照元 [#f4a6bee4] #backlinks *説明 [#u29d8568] -パス: [[linux-5.15/mm/vmscan.c]] -FIXME: これは何? --説明 **引数 [#h1375883] -pg_data_t *pgdat --メモリノード。 --[[linux-5.15/pg_data_t]] -struct scan_control *sc -- --[[linux-5.15/scan_control]] **返り値 [#udd2c8c2] -bool -- **参考 [#zc6f4078] *実装 [#v7e3840d] /* * kswapd shrinks a node of pages that are at or below the highest usable * zone that is currently unbalanced. * * Returns true if kswapd scanned at least the requested number of pages to * reclaim or if the lack of progress was due to pages under writeback. * This is used to determine if the scanning priority needs to be raised. */ static bool kswapd_shrink_node(pg_data_t *pgdat, struct scan_control *sc) { struct zone *zone; int z; /* Reclaim a number of pages proportional to the number of zones */ sc->nr_to_reclaim = 0; for (z = 0; z <= sc->reclaim_idx; z++) { zone = pgdat->node_zones + z; if (!managed_zone(zone)) continue; sc->nr_to_reclaim += max(high_wmark_pages(zone), SWAP_CLUSTER_MAX); } - -ページのあるゾーンは無視する。ゾーンのhigh watermarkか、32ページ以上は回収する。 -SWAP_CLUSTER_MAX = 32 --[[linux-5.15/managed_zone()]] --[[linux-5.15/high_wmark_pages()]] /* * Historically care was taken to put equal pressure on all zones but * now pressure is applied based on node LRU order. */ shrink_node(pgdat, sc); - --[[linux-5.15/shrink_node()]] /* * Fragmentation may mean that the system cannot be rebalanced for * high-order allocations. If twice the allocation size has been * reclaimed then recheck watermarks only at order-0 to prevent * excessive reclaim. Assume that a process requested a high-order * can direct reclaim/compact. */ if (sc->order && sc->nr_reclaimed >= compact_gap(sc->order)) sc->order = 0; return sc->nr_scanned >= sc->nr_to_reclaim; } - --[[linux-5.15/compact_gap()]] *コメント [#b1e317ab]