ó ć ”\c@sddlmZddlTddlZddlZddlZddlZddlm Z ej j ƒZ e ƒZ dejfd„ƒYZdS(i(tbase(t*i˙˙˙˙N(tcommandstVMPlugincBsźeZdZed„ƒZd„Zd„Zed„ƒZedƒd„ƒZ edƒd„ƒZ e dƒd „ƒZ e dƒd „ƒZ ed ƒd „ƒZe d ƒd „ƒZRS(s( Plugin for tuning memory management. cCsidd6dd6dd6S(Nttransparent_hugepagesttransparent_hugepagestransparent_hugepage.defrag(tNone(tself((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_get_config_optionsscCst|_t|_dS(N(tTruet_has_static_tuningtFalset_has_dynamic_tuning(Rtinstance((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_instance_inits cCsdS(N((RR ((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_instance_cleanupscCs%d}tjj|ƒs!d}n|S(Ns#/sys/kernel/mm/transparent_hugepages*/sys/kernel/mm/redhat_transparent_hugepage(tostpathtexists(RR((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt _thp_path!s RcCsÜ|d kr0|s,tjdt|ƒƒndStjddtƒ}|jdƒdkrt|sptjd ƒndSt j j |j ƒd ƒ}t j j |ƒrž|sştj||ƒn|S|sÔtjd ƒndSdS( Ntalwaystnevertmadvises-Incorrect 'transparent_hugepages' value '%s'.s /proc/cmdlinetno_errorstransparent_hugepage=isWtransparent_hugepage is already set in kernel boot cmdline, ingoring value from profiletenabledsDOption 'transparent_hugepages' is not supported on current hardware.(salwaysRR(tlogtwarntstrRtcmdt read_fileR tfindtinfoRRtjoinRRt write_to_file(Rtvaluetsimtcmdlinetsys_file((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_set_transparent_hugepages)s" RcCs|j||ƒdS(N(R&(RR"R#((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_set_transparent_hugepageAscCsKtjj|jƒdƒ}tjj|ƒrCtjtj|ƒƒSdSdS(NR( RRR RRRtget_active_optionRR(RR%((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_get_transparent_hugepagesEscCs |jƒS(N(R)(R((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt_get_transparent_hugepageNsstransparent_hugepage.defragcCshtjj|jƒdƒ}tjj|ƒrJ|sFtj||ƒn|S|s`tjdƒndSdS(NtdefragsJOption 'transparent_hugepage.defrag' is not supported on current hardware.( RRR RRRR!RRR(RR"R#R%((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt _set_transparent_hugepage_defragRscCsKtjj|jƒdƒ}tjj|ƒrCtjtj|ƒƒSdSdS(NR+( RRR RRRR(RR(RR%((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyt _get_transparent_hugepage_defrag^s(t__name__t __module__t__doc__t classmethodRRRRt command_setR&R't command_getR)R*R,R-(((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyR s    (tRt decoratorst tuned.logsttunedRtstructtglobttuned.utils.commandsRtlogstgetRRtPluginR(((s;/usr/lib/python2.7/site-packages/tuned/plugins/plugin_vm.pyts