#author("2025-09-10T18:12:51+09:00","default:guest","guest") #author("2025-09-10T18:14:36+09:00","default:guest","guest") *参照元 [#s3dd7073] #backlinks *説明 [#a5031475] -パス: [[linux-5.15/mm/compaction.c]] -ノードのフラグメンテーションスコアの閾値を取得します。lowとhighの2種類があります。 -ノードの断片化スコアの閾値を取得します。lowとhighの2種類があります。 --説明 **引数 [#ta290c81] -pg_data_t *pgdat --メモリノード。 --[[linux-5.15/pg_data_t]] -bool low --low側の閾値を取得するならtrue、high側の閾値を取得するならfalse。 **返り値 [#g4b889e1] -unsigned int --フラグメンテーションスコアの閾値(0〜100) --断片化スコアの閾値(0〜100) **参考 [#l00350ea] *実装 [#u9bd3094] static unsigned int fragmentation_score_wmark(pg_data_t *pgdat, bool low) { unsigned int wmark_low; /* * Cap the low watermark to avoid excessive compaction * activity in case a user sets the proactiveness tunable * close to 100 (maximum). */ wmark_low = max(100U - sysctl_compaction_proactiveness, 5U); return low ? wmark_low : min(wmark_low + 10, 100U); } lowの値は100 - compaction_proactivenessで、low(引数low = true)はwmark_lowを返し、high(引数low = false)はwmark_low + 10〜100を返します。すなわちlowの値域は5〜100で、highはlow + 10なので値域は15〜100です。sysctl_compaction_proactivenessは/proc/sys/vm/compaction_proactivenessに指定した値です。 | compaction_proactiveness | wmark_low | wmark_high | | 0 | 100 | 100 | | 10 | 90 | 100 | | 20 | 80 | 90 | | 50 | 50 | 60 | | 90 | 10 | 20 | | 95 | 5 | 15 | | 100 | 5 | 15 | compaction_proactivenessと閾値の算出例です。 *コメント [#d07e72d9]