#author("2025-09-10T18:35:02+09:00","default:guest","guest")
#author("2025-09-10T18:50:35+09:00","default:guest","guest")
*参照元 [#gc2f4d05]
#backlinks

*説明 [#pd187890]
-パス: [[linux-5.15/mm/compaction.c]]

-ゾーンの断片化スコア(比重付き)を取得する。


**引数 [#i6d2543c]
-struct zone *zone
--メモリゾーン。
--[[linux-5.15/zone]]


**返り値 [#u2c23daa]
-unsigned int
--ゾーンの比重付き断片化スコア(0〜100)


**参考 [#ub76a588]


*実装 [#q38280bb]

 /*
  * A weighted zone's fragmentation score is the external fragmentation
  * wrt to the COMPACTION_HPAGE_ORDER scaled by the zone's size. It
  * returns a value in the range [0, 100].
  *
  * The scaling factor ensures that proactive compaction focuses on larger
  * zones like ZONE_NORMAL, rather than smaller, specialized zones like
  * ZONE_DMA32. For smaller zones, the score value remains close to zero,
  * and thus never exceeds the high threshold for proactive compaction.
  */
 static unsigned int fragmentation_score_zone_weighted(struct zone *zone)
 {
 	unsigned long score;
 
 	score = zone->present_pages * fragmentation_score_zone(zone);
 	return div64_ul(score, zone->zone_pgdat->node_present_pages + 1);
 }

-比重のついたゾーンの断片化スコア = (ゾーンの持つページ数 * 断片化スコア) / ノードの持つページ数
-ノードは複数のゾーンを持つので、大きいゾーンのスコアを重視し、小さいゾーンのスコアを軽視する仕組みになっています。
-ノードは複数のゾーンを持つので、大きいゾーンのスコアを重視し、小さいゾーンのスコアを軽視する仕組みです。
--[[linux-5.15/fragmentation_score_zone()]]


*コメント [#sbbf0ef8]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS