+
     Gi"  c                   s    ^RI Ht ^RI5 ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ]P                  P                  4       t]
! 4       t ! R R]P                  4      tR# )i   )base)Z*N)commandsc                   s  a  ] tR t^t o Rt]R 4       t]R 4       t]R 4       t	R t
R t]R 4       t]! R4      R	 4       t]! R
4      R 4       t]! R4      R 4       t]! R
4      R 4       t]! R4      R 4       t]! R4      R 4       tR tR tR t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       tR tRtV tR# )VMPlugina  
Tunes selected sysctl options in `/proc/sys/vm`, currently
[option]`dirty_ratio`, [option]`dirty_background_ratio`,
[option]`dirty_bytes`, and [option]`dirty_background_bytes`.
See https://docs.kernel.org/admin-guide/sysctl/vm.html for detailed
documentation of these options.

Additionaly enables or disables transparent huge pages depending on
the value of the [option]`transparent_hugepages` option. The option
can have one of three possible values: `always`, `madvise` and `never`.

.Disable transparent hugepages
====
----
[vm]
transparent_hugepages=never
----
====

The [option]`transparent_hugepage.defrag` option specifies the
defragmentation policy. Possible values for this option are `always`,
`defer`, `defer+madvise`, `madvise` and `never`. For a detailed
explanation of these values refer to
link:https://www.kernel.org/doc/Documentation/vm/transhuge.txt[Transparent Hugepage Support].
c                s"    R RRRRRRRRRRRRR/# )transparent_hugepagesNtransparent_hugepagetransparent_hugepage.defragdirty_bytesdirty_ratiodirty_background_bytesdirty_background_ratio )self   &</usr/lib/python3.14/site-packages/tuned/plugins/plugin_vm.py_get_config_optionsZVMPlugin._get_config_options)   s1     TD 444dd
     c                s    V P                   V,          e8   V P                   V,          e!   \        P                  RV: RV: R24       R # R # R # )NzConflicting options 'z' and 'z%', this may cause undefined behavior.)Zoptionslogwarning)instanceZfirstZsecond   &&&r    _check_conflicting_dirty_optionsZ)VMPlugin._check_conflicting_dirty_options5   s?    e(X-=-=f-E-Q;;Z_aghi .R(r   c                sB    \         P                  P                  R V 4      # )z/proc/sys/vm)ospathjoin)optionr   r   _proc_sys_vm_option_pathZ!VMPlugin._proc_sys_vm_option_path:   s    	nf	--r   c                sn    R Vn         RVn        V P                  VRR4       V P                  VRR4       R# )TFr   r   r   r	   N)Z_has_static_tuningZ_has_dynamic_tuningr   r   r      &&r   _instance_initZVMPlugin._instance_init>   s8     $(!&(''-O''2JLder   c                s    R # Nr
   r   r   r   _instance_cleanupZVMPlugin._instance_cleanupD   s    r   c                sX    R p\         P                  P                  V4      '       g   RpV# )z#/sys/kernel/mm/transparent_hugepagez*/sys/kernel/mm/redhat_transparent_hugepage)r   r   exists)r   r   s   & r   	_thp_pathZVMPlugin._thp_pathG   s$    	.$			74	+r   r   c                s^   VR9  d0   V'       g&   \         P                  R\        V4      ,          4       R# \        P	                  RRR7      pVP                  R4      ^ 8  d    V'       g   \         P                  R4       R# \        P                  P                  V P                  4       R4      p\        P                  P                  V4      '       d;   V'       g1   \        P                  YaV'       d   \        P                  .MR	R7       V# V'       g   \         P                  R
4       R# )alwaysz-Incorrect 'transparent_hugepages' value '%s'.Nz/proc/cmdlineTZno_errorztransparent_hugepage=zWtransparent_hugepage is already set in kernel boot cmdline, ignoring value from profileenabledFzDOption 'transparent_hugepages' is not supported on current hardware.)r!   ZneverZmadvise)r   r   Zstrcmd	read_fileZfindinfor   r   r   r    r   write_to_fileerrnoENOENT)r   valuer   simremoveZcmdlinesys_files   &&&&&  r   _set_transparent_hugepagesZ#VMPlugin._set_transparent_hugepagesO   s    
00
KK?#e*LM
MM/dM;'\\)*Q.
HHfg
WW\\$..*I6(WW^^H
h"(e  5
<
KKVW
r   r   c                s*    V P                  WW44       R # r   )r.   )r   r*   r   r+   r,   s   &&&&&r   _set_transparent_hugepageZ"VMPlugin._set_transparent_hugepageh   s    !!%3?r   c                    \         P                  P                  V P                  4       R 4      p\         P                  P	                  V4      '       d)   \
        P                  \
        P                  V4      4      # R# )r#   Nr   r   r   r    r   r$   Zget_active_optionr%   r   r   r-      && r   _get_transparent_hugepagesZ#VMPlugin._get_transparent_hugepagesl   sM    WW\\$..*I6(WW^^H


h 7
88
r   c                s$    V P                  V4      # r   )r4   r   r   r   _get_transparent_hugepageZ"VMPlugin._get_transparent_hugepageu   s    		(	(	22r   r   c                sZ   \         P                  P                  V P                  4       R 4      p\         P                  P	                  V4      '       d;   V'       g1   \
        P                  YQV'       d   \        P                  .MRR7       V# V'       g   \        P                  R4       R# )defragFr"   zJOption 'transparent_hugepage.defrag' is not supported on current hardware.N)r   r   r   r    r   r$   r'   r(   r)   r   r   )r   r*   r   r+   r,   r-   s   &&&&& r    _set_transparent_hugepage_defragZ)VMPlugin._set_transparent_hugepage_defragy   sm    WW\\$..*H5(WW^^H
h"(e  5
<
KK\]
r   c                r0   )r6   Nr1   r2   r3   r    _get_transparent_hugepage_defragZ)VMPlugin._get_transparent_hugepage_defrag   sM    WW\\$..*H5(WW^^H


h 7
88
r   c                s    ^\        \        P                  R4      4      ,          pW#8  d!   \        P	                  RV: RV: R24       R# R# )i   ZPAGESIZEzThe value of 'z(' must be at least twice the page size (z).FT)intr$   Zgetconfr   error)r   r   	int_valueZ	min_bytess   &&& r   _check_twice_pagesizeZVMPlugin._check_twice_pagesize   s8    #ckk*-..)99vW`ab
	r   c                sP    V^ 8:  d   \         P                  RV,          4       R# R# )    z#The value of '%s' must be positive.FTr   r:   r   r   r;   r   r   _check_positiveZVMPlugin._check_positive   s!    !^992V;<
	r   c                sd    ^ Tu;8:  d   ^d8:  g!   M \         P                  RV,          4       R# R# )r=   z,The value of '%s' must be between 0 and 100.FTr>   r?   r   r   _check_ratioZVMPlugin._check_ratio   s'    	
i	3	99;fDE
	r   r   c           	     
   Veb   VP                  4       P                  R4      '       d=   V P                  RRV P                  WP                  4       P	                  R4      V4      # V P                  RRV P
                  WV4      # )N%r   r   )stripendswith_dirty_optionrA   rstripr<   r   enablingr*   verifyZignore_missingr      &&&&&&r   _dirty_bytesZVMPlugin._dirty_bytes   st    
5;;=11#66


]M4;L;LhXcXcXeXlXlmpXqsy
zz			M=$:T:TV^gm	nnr   r   c                j    \         P                  R 4       V P                  RRV P                  WV4      # )zlThe 'dirty_ratio' option is deprecated and does not support inheritance, use 'dirty_bytes' with '%' instead.r   r   r   r   rF   rA   rH   rK   r   _dirty_ratioZVMPlugin._dirty_ratio   s/    ++|}			M=$:K:KX^d	eer   r   c           	     rB   )NrC   r	   r   )rD   rE   rF   rA   rG   r@   rH   rK   r   _dirty_background_bytesZ VMPlugin._dirty_background_bytes   s    
5;;=11#66


57OQUQbQbdlnynyn{  oC  oC  DG  oH  JP  Q  Q			46NPTPdPdfnw}	~~r   r	   c                rM   )zThe 'dirty_background_ratio' option is deprecated and does not support inheritance, use 'dirty_background_bytes' with '%' instead.r	   r   rN   rH   rK   r   _dirty_background_ratioZ VMPlugin._dirty_background_ratio   s9    ++  S  T			46NPTPaPacktz	{{r   c                s(   V P                  V4      pV P                  V4      pV P                  VR 7      p	V P                  VR 7      p
\        P                  P	                  V4      '       g   \
        P                  RV,          4       \        P                  V4      P                  4       pV'       d   W8H  # V'       d    \        V4      pT! Y4      '       g   R# Y8X  d!   \
        P                  RT: RT: R24       T# \        T4      ^ 8X  d@   \        P                  T4      P                  4       pT P                  P                  Y4       MT P                  P                  Y4       \
        P                  RT: RT: R24       \        P!                  Yu4       T# V P                  P#                  V	4      pV P                  P#                  V
4      pVe6   \
        P                  RV: RV: R	24       \        P!                  W~4       R# Ve6   \
        P                  RV: RV: R	24       \        P!                  W4       R# \
        P                  R
V,          4       R#   \         d!    \
        P                  RT,          4        R# i ; i))Zcommand_namez5Option '%s' is not supported on the current hardware.z%The value of '%s' must be an integer.NzNot setting option 'z' to 'z', already set.zSetting option 'z'.Z'z:Not restoring '%s', previous value is the same or unknown.)r   Z_storage_keyr   r   Zisfiler   r   r$   r%   rD   r9   Z
ValueErrorr:   r&   Z_storageZsetr'   get)r   r   ZcounterpartZ	check_funrI   r*   rJ   Zoption_pathZcounterpart_pathZ
option_keyZcounterpart_keyZcurrent_valuer;   Zcurrent_counterpart_valueZ	old_valueZold_counterpart_values   &&&&&&&         r   rF   ZVMPlugin._dirty_option   s   --f5+22;?  f 5*%%;%?/		$	$;;FOP--,224-

  E
I F
&
&HHNOL 
-A #.> ? E E GMMoAMMj088fe<=[(
< mm
+)--++O<88VY?@[, 
 (88[:OPQ%= 
 88H6QR	A  II5>?s    I& &'JJr
   N) Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__Zclassmethodr   Zstaticmethodr   r   r   r   r    Zcommand_setr.   r/   Zcommand_getr4   r5   r7   r8   r<   r@   rA   Zcommand_customrL   rO   rP   rQ   rF   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      s    4 	 	 j j . .f   %& '0 $%@ &@ %& ' $%3 &3 +,
 -
 +, - o  o
 f  f )* +
 )*| +|- -r   r   )Z r    Z
decoratorsZ
tuned.logsZtunedr   r(   ZstructZglobZtuned.utils.commandsr   ZlogsrR   r   r$   ZPluginr   r
   r   r   <module>rS      sF       	    )jjnnjVt{{ Vr   