8.3.2. KSM チューニングサービス
ksmtuned サービスは、ksm をループおよびチューニングすることにより、kernel same-page merging (KSM) の設定を微調整します。さらに、ゲスト仮想マシンが作成または破棄されると、ksmtuned サービスに libvirt から通知されます。ksmtuned サービスにはオプションがありません。
# systemctl start ksmtuned
Starting ksmtuned: [ OK ]
ksmtuned サービスは、チューニング機能を手動で実行するように ksmtuned に指示する retune パラメーターを使用してチューニングできます。
/etc/ksmtuned.conf ファイルは、ksmtuned サービスの設定ファイルです。以下のファイル出力は、デフォルトの ksmtuned.conf ファイルです。
# Configuration file for ksmtuned.
# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60
# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10
# KSM_NPAGES_BOOST - is added to the `npages` value, when `free memory` is less than `thres`.
# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY - is the value given is subtracted to the `npages` value, when `free memory` is greater than `thres`.
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN - is the lower limit for the `npages` value.
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX - is the upper limit for the `npages` value.
# KSM_NPAGES_MAX=1250
# KSM_THRES_COEF - is the RAM percentage to be calculated in parameter `thres`.
# KSM_THRES_COEF=20
# KSM_THRES_CONST - If this is a low memory system, and the `thres` value is less than `KSM_THRES_CONST`, then reset `thres` value to `KSM_THRES_CONST` value.
# KSM_THRES_CONST=2048
# uncomment the following to enable ksmtuned debug information
# LOGFILE=/var/log/ksmtuned
# DEBUG=1
/etc/ksmtuned.conf ファイル内で、npages は、ksmd デーモンが非アクティブになる前に ksm がスキャンするページ数を設定します。この値は、/sys/kernel/mm/ksm/pages_to_scan ファイルでも設定されます。
The
KSM_THRES_CONST の値は、ksm をアクティブ化するためのしきい値として使用される使用可能なメモリーの量を表します。次のいずれかが発生した場合、ksmd がアクティブになります。
- 空きメモリーの量が、
KSM_THRES_CONSTで設定されたしきい値を下回る。 - コミットされたメモリーの量としきい値
KSM_THRES_CONSTが、メモリーの合計量を超えている。