#author("2025-09-11T16:48:31+09:00","default:guest","guest") #author("2025-09-11T16:53:22+09:00","default:guest","guest") *参照元 [#f43a7633] #backlinks *説明 [#j16e04fd] -パス: [[linux-5.15/mm/vmscan.c]] -FIXME: これは何? --説明 -メモリノードの空きページのバランスが取れているか取得します。 --high watermark以上のゾーンが1つでもあれば、バランスが取れているものとします。 **引数 [#pe3fbc69] -pg_data_t *pgdat -- --メモリノード。 --[[linux-5.15/pg_data_t]] -int order -- --オーダー。 -int highest_zoneidx -- --メモリを確保する最大のゾーンインデックス値。この値以下のゾーンがチェック対象です。 **返り値 [#pfb1d6b7] -bool -- --メモリノードの空きページのバランスが取れていればtrue、取れていなければfalse。 **参考 [#rec47f64] *実装 [#qd517d28] /* * Returns true if there is an eligible zone balanced for the request order * and highest_zoneidx */ static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx) { int i; unsigned long mark = -1; struct zone *zone; /* * Check watermarks bottom-up as lower zones are more likely to * meet watermarks. */ for (i = 0; i <= highest_zoneidx; i++) { zone = pgdat->node_zones + i; if (!managed_zone(zone)) continue; -ページがないゾーンは無視します。 --[[linux-5.15/managed_zone()]] mark = high_wmark_pages(zone); if (zone_watermark_ok_safe(zone, order, mark, highest_zoneidx)) return true; } - --[[linux-5.15/managed_zone()]] -high watermark以上の空きページを持つゾーンが1つでもあれば、バランスが取れているものとします。 --[[linux-5.15/high_wmark_pages()]] --[[linux-5.15/zone_watermark_ok_safe()]] /* * If a node has no populated zone within highest_zoneidx, it does not * need balancing by definition. This can happen if a zone-restricted * allocation tries to wake a remote kswapd. */ if (mark == -1) return true; -全てのゾーンにページがない場合はバランスがとれているものとします。 return false; } *コメント [#m431c4de]