+
     Gi  c                   s   ^RI Ht ^RI5 ^ RIt^ RIt^ RI5 ^ RIt ^ RIt^ RI
t
^ RIHt ^ RIt^ RIHt ^ RIt^ RIt^ RIt^ RIt ]P(                   ]P.                  P1                  4       t ! R R]4      t ! R R]4      t ! R	 R
]4      t ! R R]4      t ! R R]P>                  4      t R#   ]	 d     Li ; i  ] d    ^ RIt Lwi ; i)   )base)*N)commandsc                   s^   a  ] tR t^!t o RR lt]R 4       t]P                  R 4       tRtV t	R# )SchedulerParamsNc                sN    Wn         W n        W0n        W@n        WPn        W`n        R # N)_cmdcmdline	schedulerpriorityaffinitycgroup)selfcmdr   r   r	   r
   r   s   &&&&&&&C/usr/lib/python3.14/site-packages/tuned/plugins/plugin_scheduler.py__init__ZSchedulerParams.__init__"   s     ),.--+    c                sl    V P                   f   R # V P                  P                  V P                   4      # r   )	_affinityr   Zbitmask2cpulistr      &r   r
   SchedulerParams.affinity+   s(    	^^

))
#
#DNN
33r   c                s`    Vf
   R V n         R # V P                  P                  V4      V n         R # r   )r   r   Zcpulist2bitmaskr   value   &&r   r
   r   2   s$    
]4>II--e44>r   )r   r   r
   r   r   r	   r   )NNNNN)
__name__
__module____qualname____firstlineno__r   Zpropertyr
   Zsetter__static_attributes____classdictcell____classdict__   @r   r   r   !   s6      4 4 //5 5r   r   c                   s&   a  ] tR t^9t o R tRtV tR# )IRQAffinitiesc                s0    / V n         R V n        . V n        R # r   )irqsdefaultunchangeabler   r   r   r   ZIRQAffinities.__init__:   s    $)$,$r   )r#   r"   r$   N)r   r   r   r   r   r   r   r   r    r   r!   r!   9   s      r   r!   c            
       sx   a  ] tR t^@t o RtRRRRRRRR	R
R/tR tR tR tR t	R t
R tR tR tR tR tRtV tR# )SchedulerUtilsz;
Class encapsulating scheduler implementation in os module
f
SCHED_FIFOZbZSCHED_BATCHrZSCHED_RRoZSCHED_OTHERZiZ
SCHED_IDLEc                    \        R  V P                  P                  4        4       4      V n        \        R V P                  P	                  4        4       4      V n        R# )c              3   J   "   T F  w  rV\        \        V4      3x  K  	  R # 5ir   getattros.0kname   &  r   	<genexpr>*SchedulerUtils.__init__.<locals>.<genexpr>O   s       nGmGA!WR%6!7Gm   !#c              3   F   "   T F  p\        \        V4      V3x  K  	  R # 5ir   r,   r0   r2      & r   r4   r5   Q   s     "qIpGB$5t#<Ip   !Ndict_dict_schedcfg2schedconstitems_dict_schedcfg2numvalues_dict_num2schedconstr   r   r   r   ZSchedulerUtils.__init__M   sF      ntGeGeGkGkGm nn$""qIgIgInInIp"qq$r   c                8    V P                   P                  V4      # r   )r?   get)r   str_schedulerr   r   sched_cfg_to_numZSchedulerUtils.sched_cfg_to_numS   s    		 	 	$	$]	33r   c                rB   r   )rA   rC   )r   r   r   r   sched_num_to_constZ!SchedulerUtils.sched_num_to_constW   s    		"	"	&	&y	11r   c                .    \         P                  ! V4      # r   )r.   Zsched_getschedulerr   pidr   r   get_schedulerZSchedulerUtils.get_schedulerZ   s    			s	##r   c                s\    \         P                  ! W\         P                  ! V4      4       R # r   )r.   Zsched_setschedulerZsched_paramr   rI   schedprio   &&&&r   set_schedulerZSchedulerUtils.set_scheduler]   s    BNN4$89r   c                rG   r   )r.   Zsched_getaffinityrH   r   r   get_affinityZSchedulerUtils.get_affinity`   s    			c	""r   c                2    \         P                  ! W4       R # r   )r.   Zsched_setaffinityr   rI   r
      &&&r   set_affinityZSchedulerUtils.set_affinityc   s    s%r   c                sB    \         P                  ! V4      P                  # r   )r.   Zsched_getparamZsched_priorityrH   r   r   get_priorityZSchedulerUtils.get_priorityf   s    			3		.	..r   c                rG   r   )r.   Zsched_get_priority_minr   rL   r   r   get_priority_minZSchedulerUtils.get_priority_mini       		"	"5	))r   c                rG   r   )r.   Zsched_get_priority_maxrV   r   r   get_priority_maxZSchedulerUtils.get_priority_maxl   rX   r   rA   r?   N)r   r   r   r   __doc__r=   r   rE   rF   rJ   rO   rP   rT   rU   rW   rY   r   r   r   r    r   r%   r%   @   se     
 |}z}|r42$:#&/** *r   r%   c                   sT   a  ] tR t^ot o RtR tR tR tR tR t	R t
R tR	 tR
tV tR# )SchedulerUtilsSchedutilszC
Class encapsulating scheduler implementation in schedutils module
c                r*   )c              3   r+   r   r-   
schedutilsr/   r3   r   r4   4SchedulerUtilsSchedutils.__init__.<locals>.<genexpr>u   s       vOuGA!WZ%>!?Our6   c              3   r7   r   r]   r8   r9   r   r4   r_   w   s     "yQxGJ$=t#DQxr:   Nr;   r   r   r   r   Z!SchedulerUtilsSchedutils.__init__s   sG      vtOmOmOsOsOu vv$""yQUQoQoQvQvQx"yy$r   c                rG   r   )r^   rJ   rH   r   r   rJ   Z&SchedulerUtilsSchedutils.get_schedulery   s    		!	!#	&&r   c                s4    \         P                  ! WV4       R # r   )r^   rO   rK   rN   r   rO   Z&SchedulerUtilsSchedutils.set_scheduler|   s    3t,r   c                rG   r   )r^   rP   rH   r   r   rP   Z%SchedulerUtilsSchedutils.get_affinity       		 	 	%%r   c                rQ   r   )r^   rT   rR   rS   r   rT   Z%SchedulerUtilsSchedutils.set_affinity   s    #(r   c                rG   r   )r^   rU   rH   r   r   rU   Z%SchedulerUtilsSchedutils.get_priority   r`   r   c                rG   r   )r^   rW   rV   r   r   rW   Z)SchedulerUtilsSchedutils.get_priority_min       		$	$U	++r   c                rG   r   )r^   rY   rV   r   r   rY   Z)SchedulerUtilsSchedutils.get_priority_max   ra   r   rZ   N)r   r   r   r   r[   r   rJ   rO   rP   rT   rU   rW   rY   r   r   r   r    r   r\   r\   o   s8     z'-&)&,, ,r   r\   c                   st  a a ] tR t^t oRtRRRRRR/tR tV 3R ltR	 tR
 t	R t
]R 4       tR tR tR tR tR tR tR tR tR tR tR tR|R ltR tR tR tR|R ltR tR tR  tR! t R" t!R# t"R$ t#R% t$R& t%R' t&R|R( lt'R) t(R* t)V 3R+ lt*R, t+R- t,R. t-].P^                  3V 3R/ llt0R0 t1R1 t2V 3R2 lt3R3 t4R4 t5R5 t6]7! R6RR77      R8 4       t8]7! R9RR77      R: 4       t9]7! R;RR77      R< 4       t:]7! R=RR77      R> 4       t;]7! R?RR77      R@ 4       t<]7! RARR77      RB 4       t=]7! RCRR77      RD 4       t>RE t?RF t@RG tAR|RH ltBRI tCRJ tDRK tERL tFRM tGRN tHRO tIRP tJRQ tK]7! RRR^
RS7      RT 4       tLRU tMRV tNRW tORX tPR|RY ltQ]R! RZ4      R[ 4       tS]T! RZ4      R\ 4       tU]R! R]4      R^ 4       tV]T! R]4      R_ 4       tW]R! R`4      Ra 4       tX]T! R`4      Rb 4       tY]R! Rc4      Rd 4       tZ]T! Rc4      Re 4       t[]R! Rf4      Rg 4       t\]T! Rf4      Rh 4       t]]R! Ri4      Rj 4       t^]T! Ri4      Rk 4       t_]R! Rl4      Rm 4       t`]T! Rl4      Rn 4       ta]R! Ro4      Rp 4       tb]T! Ro4      Rq 4       tc]R! Rr4      Rs 4       td]T! Rr4      Rt 4       te]R! Ru4      Rv 4       tf]T! Ru4      Rw 4       tg]R! Rx4      Ry 4       th]T! Rx4      Rz 4       tiR{tjVtkV ;tl# )}SchedulerPluginaT-  
Allows tuning of scheduling priorities, process/thread/IRQ
affinities, and CPU isolation.

To prevent processes/threads/IRQs from using certain CPUs, use
the [option]`isolated_cores` option. It changes process/thread
affinities, IRQs affinities and it sets `default_smp_affinity`
for IRQs. The CPU affinity mask is adjusted for all processes and
threads matching [option]`ps_whitelist` option subject to success
of the `sched_setaffinity()` system call. The default setting of
the [option]`ps_whitelist` regular expression is `.*` to match all
processes and thread names. To exclude certain processes and threads
use [option]`ps_blacklist` option. The value of this option is also
interpreted as a regular expression and process/thread names (`ps -eo
cmd`) are matched against that expression. Profile rollback allows
all matching processes and threads to run on all CPUs and restores
the IRQ settings prior to the profile application.

Multiple regular expressions for [option]`ps_whitelist`
and [option]`ps_blacklist` options are allowed and separated by
`;`. Quoted semicolon `\;` is taken literally.

.Isolate CPUs 2-4
====
----
[scheduler]
isolated_cores=2-4
ps_blacklist=.*pmd.*;.*PMD.*;^DPDK;.*qemu-kvm.*
----
Isolate CPUs 2-4 while ignoring processes and threads matching
`ps_blacklist` regular expressions.
====

The [option]`irq_process` option controls whether the scheduler plugin
applies the `isolated_cores` parameter to IRQ affinities. The default
value is `true`, which means that the scheduler plugin will move all
possible IRQs away from the isolated cores. When `irq_process` is set
to `false`, the plugin will not change any IRQ affinities.

The [option]`default_irq_smp_affinity` option controls the values
*TuneD* writes to `/proc/irq/default_smp_affinity`. The file specifies
default affinity mask that applies to all non-active IRQs. Once an
IRQ is allocated/activated its affinity bitmask will be set to the
default mask.

The following values are supported:

* `calc`
+
The content of `/proc/irq/default_smp_affinity` will be calculated
from the `isolated_cores` parameter. Non-isolated cores
are calculated as an inversion of the `isolated_cores`. Then
the intersection of the non-isolated cores and the previous
content of `/proc/irq/default_smp_affinity` is written to
`/proc/irq/default_smp_affinity`. If the intersection is
an empty set, then just the non-isolated cores are written to
`/proc/irq/default_smp_affinity`. This behavior is the default if
the parameter `default_irq_smp_affinity` is omitted.

* `ignore`
+
*TuneD* will not touch `/proc/irq/default_smp_affinity`.

* an explicit cpulist
+
The cpulist (such as `1,3-4`) is unpacked and written directly to
`/proc/irq/default_smp_affinity`.

.An explicit CPU list to set the default IRQ smp affinity to CPUs 0 and 2
====
----
[scheduler]
isolated_cores=1,3
default_irq_smp_affinity=0,2
----
====

To adjust scheduling policy, priority and affinity for a group of
processes/threads, use the following syntax.

[subs="quotes"]
----
group.__groupname__=__rule_prio__:__sched__:__prio__:__affinity__:__regex__
----

Here, `__rule_prio__` defines internal *TuneD* priority of the
rule. Rules are sorted based on priority. This is needed for
inheritence to be able to reorder previously defined rules. Equal
`__rule_prio__` rules should be processed in the order they were
defined. However, this is Python interpreter dependant. To disable
an inherited rule for `__groupname__` use:

[subs="quotes"]
----
group.__groupname__=
----

`__sched__` must be one of:
*`f`* for FIFO,
*`b`* for batch,
*`r`* for round robin,
*`o`* for other,
*`*`* do not change.

`__affinity__` is CPU affinity in hexadecimal. Use `*` for no change.

`__prio__` scheduling priority (see `chrt -m`).

`__regex__` is Python regular expression. It is matched against the output of:

[subs="quotes"]
----
ps -eo cmd
----

Any given process name may match more than one group. In such a case,
the priority and scheduling policy are taken from the last matching
`__regex__`.

.Setting scheduling policy and priorities to kernel threads and watchdog
====
----
[scheduler]
group.kthreads=0:*:1:*:\[.*\]$
group.watchdog=0:f:99:*:\[watchdog.*\]
----
====

The scheduler plug-in uses perf event loop to catch newly created
processes. By default it listens to `perf.RECORD_COMM` and
`perf.RECORD_EXIT` events. By setting [option]`perf_process_fork`
option to `true`, `perf.RECORD_FORK` events will be also listened
to. In other words, child processes created by the `fork()` system
call will be processed. Since child processes inherit CPU affinity
from their parents, the scheduler plug-in usually does not need to
explicitly process these events. As processing perf events can
pose a significant CPU overhead, the [option]`perf_process_fork`
option parameter is set to `false` by default. Due to this, child
processes are not processed by the scheduler plug-in.

The CPU overhead of the scheduler plugin can be mitigated by using
the scheduler [option]`runtime` option and setting it to `0`. This
will completely disable the dynamic scheduler functionality and the
perf events will not be monitored and acted upon. The disadvantage
ot this approach is the procees/thread tuning will be done only at
profile application.

.Disabling the scheduler dynamic functionality
====
----
[scheduler]
runtime=0
isolated_cores=1,3
----
====

NOTE: For perf events, memory mapped buffer is used. Under heavy load
the buffer may overflow. In such cases the `scheduler` plug-in
may start missing events and failing to process some newly created
processes. Increasing the buffer size may help. The buffer size can
be set with the [option]`perf_mmap_pages` option. The value of this
parameter has to expressed in powers of 2. If it is not the power
of 2, the nearest higher power of 2 value is calculated from it
and this calculated value used. If the [option]`perf_mmap_pages`
option is omitted, the default kernel value is used.

The scheduler plug-in supports process/thread confinement using
cgroups v1.

[option]`cgroup_mount_point` option specifies the path to mount the
cgroup filesystem or where *TuneD* expects it to be mounted. If unset,
`/sys/fs/cgroup/cpuset` is expected.

If [option]`cgroup_groups_init` option is set to `1` *TuneD*
will create (and remove) all cgroups defined with the `cgroup*`
options. This is the default behavior. If it is set to `0` the
cgroups need to be preset by other means.

If [option]`cgroup_mount_point_init` option is set to `1`,
*TuneD* will create (and remove) the cgroup mountpoint. It implies
`cgroup_groups_init = 1`. If set to `0` the cgroups mount point
needs to be preset by other means. This is the default behavior.

The [option]`cgroup_for_isolated_cores` option is the cgroup
name used for the [option]`isolated_cores` option functionality. For
example, if a system has 4 CPUs, `isolated_cores=1` means that all
processes/threads will be moved to CPUs 0,2-3.
The scheduler plug-in will isolate the specified core by writing
the calculated CPU affinity to the `cpuset.cpus` control file of
the specified cgroup and move all the matching processes/threads to
this group. If this option is unset, classic cpuset affinity using
`sched_setaffinity()` will be used.

[option]`cgroup.__cgroup_name__` option defines affinities for
arbitrary cgroups. Even hierarchic cgroups can be used, but the
hieararchy needs to be specified in the correct order. Also *TuneD*
does not do any sanity checks here, with the exception that it forces
the cgroup to be under [option]`cgroup_mount_point`.

The syntax of the scheduler option starting with `group.` has been
augmented to use `cgroup.__cgroup_name__` instead of the hexadecimal
`__affinity__`. The matching processes will be moved to the cgroup
`__cgroup_name__`. It is also possible to use cgroups which have
not been defined by the [option]`cgroup.` option as described above,
i.e. cgroups not managed by *TuneD*.

All cgroup names are sanitized by replacing all all dots (`.`) with
slashes (`/`). This is to prevent the plug-in from writing outside
[option]`cgroup_mount_point`.

.Using cgroups v1 with the scheduler plug-in
====
----
[scheduler]
cgroup_mount_point=/sys/fs/cgroup/cpuset
cgroup_mount_point_init=1
cgroup_groups_init=1
cgroup_for_isolated_cores=group
cgroup.group1=2
cgroup.group2=0,2

group.ksoftirqd=0:f:2:cgroup.group1:ksoftirqd.*
ps_blacklist=ksoftirqd.*;rcuc.*;rcub.*;ktimersoftd.*
isolated_cores=1
----
Cgroup `group1` has the affinity set to CPU 2 and the cgroup `group2`
to CPUs 0,2. Given a 4 CPU setup, the [option]`isolated_cores=1`
option causes all processes/threads to be moved to CPU
cores 0,2-3. Processes/threads that are blacklisted by the
[option]`ps_blacklist` regular expression will not be moved.

The scheduler plug-in will isolate the specified core by writing the
CPU affinity 0,2-3 to the `cpuset.cpus` control file of the `group`
and move all the matching processes/threads to this cgroup.
====

Option [option]`cgroup_ps_blacklist` allows excluding processes
which belong to the blacklisted cgroups. The regular expression specified
by this option is matched against cgroup hierarchies from
`/proc/PID/cgroups`. Cgroups v1 hierarchies from `/proc/PID/cgroups`
are separated by commas ',' prior to regular expression matching. The
following is an example of content against which the regular expression
is matched against: `10:hugetlb:/,9:perf_event:/,8:blkio:/`

Multiple regular expressions can be separated by semicolon ';'. The
semicolon represents a logical 'or' operator.

.Cgroup-based exclusion of processes from the scheduler
====
----
[scheduler]
isolated_cores=1
cgroup_ps_blacklist=:/daemons\b
----
The scheduler plug-in will move all processes away from core 1 except processes which
belong to cgroup '/daemons'. The '\b' is a regular expression
metacharacter that matches a word boundary.
----
[scheduler]
isolated_cores=1
cgroup_ps_blacklist=\b8:blkio:
----
The scheduler plug-in will exclude all processes which belong to a cgroup
with hierarchy-ID 8 and controller-list blkio.
====

Kernels 5.13 and newer moved some `sched_` and `numa_balancing_` kernel run-time
parameters from `/proc/sys/kernel`, managed by the `sysctl` utility, to
`debugfs`, typically mounted under `/sys/kernel/debug`.  TuneD provides an
abstraction mechanism for the following parameters via the scheduler plug-in:
[option]`sched_min_granularity_ns`, [option]`sched_latency_ns`,
[option]`sched_wakeup_granularity_ns`, [option]`sched_tunable_scaling`,
[option]`sched_migration_cost_ns`, [option]`sched_nr_migrate`,
[option]`numa_balancing_scan_delay_ms`,
[option]`numa_balancing_scan_period_min_ms`,
[option]`numa_balancing_scan_period_max_ms` and
[option]`numa_balancing_scan_size_mb`.
Moreover in kernel 6.6 and newer support for the `sched_wakeup_granularity_ns` and
`sched_latency_ns` were removed. The `sched_min_granularity_ns` was renamed to
`sched_base_slice_ns`. Based on the kernel used, TuneD will write the specified
value to the correct location or ignore it. For the compatibility the alias
[option]`sched_base_slice_ns` was added, but the [option]`sched_min_granularity_ns`
can be still used instead.

.Set tasks' "cache hot" value for migration decisions.
====
----
[scheduler]
sched_migration_cost_ns=500000
----
On the old kernels, this is equivalent to:
----
[sysctl]
kernel.sched_migration_cost_ns=500000
----
that is, value `500000` will be written to `/proc/sys/kernel/sched_migration_cost_ns`.
However, on more recent kernels, the value `500000` will be written to
`/sys/kernel/debug/sched/migration_cost_ns`.
====
wakeup_granularity_ns min_granularity_nsZbase_slice_ns
latency_nsc                s>    \         P                  R 4       RV n        R# )zupython-perf unavailable, disabling perf support and runtime tuning, you can try to (re)install python(3)-perf packageFN)logwarning_perf_availabler   r   r   _disable_perfZSchedulerPlugin._disable_perf  s    ++ G H$r   c	           
     s  < \         \        V `  WW4WVWx4       R V n        \        P
                  V n        \        \        P                  4      V n	        Vep   VP                  \        P                  \        P
                  4      V n        \        VP                  \        P                  \        P                  4      4      V n	        \        4       V n        RV n        / V n        RV n        RV n        R V n        RV n        R V n         \.        P0                  ! 4       V n        V P=                  RR7      V n        R V n         V P=                  RR7      V n!        RV n"         \G        4       V n$        R#   \4        \6        3 d3    T P9                  4        T P                  P;                  4       T n         Li ; i  \6         d    \K        4       T n$         R# i ; i)TNz.*rd   r   )Zcommand_nameirq)&superrb   r   _has_dynamic_optionsconstsZCFG_DEF_DAEMON_daemonintZCFG_DEF_SLEEP_INTERVAL_sleep_intervalget_boolZ
CFG_DAEMONrC   ZCFG_SLEEP_INTERVALr   r   _secure_boot_hint_sched_knob_paths_cache_ps_whitelist_ps_blacklist_kthread_process_cgroup_ps_blacklist_reri   perfZcpu_map_cpusZ	NameErrorAttributeErrorrj   Zget_cpusZ_storage_key_scheduler_storage_key_irq_process_irq_storage_key_evlistr%   _scheduler_utilsr\   )
r   Zmonitor_repositoryZstorage_factoryZhardware_inventoryZdevice_matcherZdevice_matcher_udevZplugin_instance_factoryZ
global_cfgZ	variables	__class__s
   &&&&&&&&&r   r   ZSchedulerPlugin.__init__  s   '(:M_  rE  `j  v"$&&$,V::;$%%f&7&79N9NO4<jnnV-F-FHeHefg4j$)$!#$$$$!#$$%4: !% 1 1 !2 ! $$++ , $$,6)+4 ^	$ % 		""$4:	% 
 63546s%   E. F4 .A F10F14GGc           	     s    Vf   R #  \        V4      pT^ 8:  d   ^ # \        ^\        P                  ! \        P                  ! T^4      4      ,          4      #   \         d     ^ # i ; ir   )rp   
ValueErrormathZceilrg   )r   Z
mmap_pagesZmp   && r   _calc_mmap_pagesZ SchedulerPlugin._calc_mmap_pages  s\    
J2 1W
	Q$))DHHRO,,	-- 
 
s   A A&%A&c                s   R Vn         RVn        RVn        RVn        V P                  P                  V P                  / 4      V n        \        V P                  4      ^ 8  dR   \        P                  R4       V P                  4        / V n        V P                  P                  V P                  4       \        4       V n        R V n        RV n        R V n        \$        P&                  ! VP(                  P+                  4        UUu. uFZ  w  r#VR,          R8X  g   K  \        V4      ^8  g   K'  V P-                  VR,          4      V P.                  P1                  V4      3NK\  	  upp4      V n        VP(                  Vn        V P.                  P1                  VP(                  R,          4      pV P7                  V4      pV^ 8X  d   \        P9                  RV,          4       R pVe.   \;        V4      V8w  d   \        P                  R	WE3,          4       VP4                   F<  pV P.                  P1                  VP4                  V,          4      VP4                  V&   K>  	  V P<                  P?                  VP4                  P                  R
^4      4      R8X  d   RVn        \@        PB                  ! 4       Vn"        V PF                  '       EdN   VP                  '       Ed;   V PH                  '       Ed(    \J        PL                  ! 4       Vn'        \J        PP                  ! \J        PR                  \J        PT                  ^^^ ^ ^^\J        PV                  \J        PX                  ,          R7	      pVP[                  V P\                  VPN                  R7       \J        P^                  ! V P\                  VPN                  4      Vn         VP                   Pa                  V4       Vf   VP                   Pc                  4        MVP                   Pc                  VR7        V PH                  '       g
   RVn        R # R # u uppi    T Pe                  4         L7; i)NFTz0recovering scheduling settings from previous runN   Ncgroup.r   NNperf_mmap_pageszKInvalid 'perf_mmap_pages' value specified: '%s', using default kernel valuezL'perf_mmap_pages' value has to be power of two, specified: '%s', using: '%d'ZruntimeZ0)	typeZconfigZtaskcommmmapZfreqZwakeup_eventsZ	watermarkZsample_type)Zcpusthreads)Zpages)3r   Z_has_dynamic_tuningZ_has_static_tuning_runtime_tuning_storagerC   r|   _scheduler_originallenrg   info_restore_ps_affinityunsetr<   _cgroups_original_affinityr   _cgroup_affinity_initialized_cgroupcollectionsZOrderedDictoptionsr>   _sanitize_cgroup_path
_variablesexpand_cgroups
_schedulerr   errorstrr   rr   	threadingZEvent
_terminatero   ri   ry   Z
thread_mapZ_threadsevselZTYPE_SOFTWAREZCOUNT_SW_DUMMYZ
SAMPLE_TIDZ
SAMPLE_CPUopenrz   ZevlistZaddr   rj   )r   instanceoptionr
   Zperf_mmap_pages_rawr   r1   r   s   &&      r   _instance_initZSchedulerPlugin._instance_init  sn   (!&( $( "( "]]..%$	!	!"Q&88>? 4==t223$(F$! $.&+$#$,))#++113+d3vvbzY7N ,vSVW]S^abSb ,vD,F,Fvbz,RTXTcTcTjTjksTt+u3+d e$- !(((..x/?/?@Q/RS))*=>/99Z]ppq? S%9=P%P88Z*+ ,a OO2283F3Fq3IJ8q 	YY++//	1=>#E#8!)(	\\\h...43G3G3G)HJJd00!!a!A??T__4	6E
 
JJdjjH,=,=J>{{4::x/@/@AH?3 
			#8 
I+dDs%   P9
P9
-7P9
6DP? ?P? ?Qc                s    VP                   '       dD   VP                   P                  4        F#  p\        P                  ! VP                  4       K%  	  R # R # r   )r   
get_pollfdr.   Zcloser2   )r   r   fdr   r   _instance_cleanupZ!SchedulerPlugin._instance_cleanup;  s<    ((*rHHRWW + r   c                s    / R RbR\         P                  bRRbRRbRRbRRbR	RbR
RbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRRRRRRRRRRRRR/C# )isolated_coresNcgroup_mount_pointcgroup_mount_point_initFcgroup_groups_initTcgroup_for_isolated_corescgroup_ps_blacklistps_whitelistps_blacklistkthread_processirq_processdefault_irq_smp_affinitycalcr   perf_process_forkZfalsesched_min_granularity_nssched_base_slice_nssched_latency_nssched_wakeup_granularity_nssched_tunable_scalingsched_migration_cost_nssched_nr_migratenuma_balancing_scan_delay_ms!numa_balancing_scan_period_min_ms!numa_balancing_scan_period_max_msnuma_balancing_scan_size_mb)rn   ZDEF_CGROUP_MOUNT_POINT)Zclsr   r   _get_config_optionsZ#SchedulerPlugin._get_config_options@  s   
T
66
 e
 	

 
 $
 4
 4
 d
 $
 v
 d
 
 t
 $
  t!
" !$#
$ Ddt!4&& $1
 r   c                sD    Ve   \        V4      P                  RR4      # R # )NZ./)r   Zreplacer   r   r   r   Z%SchedulerPlugin._sanitize_cgroup_path]  s#    ).):U		C	%DDr   c                s    \        V\        P                  4      '       g   Tp\        P                  ! V4      p\        P                  ! V4      pV P	                  V4      '       d   R V,           R,           pV# )Z[Z])
isinstanceprocfsprocessZprocess_cmdline_is_kthread)r   r   rI   r      &&  r   _get_cmdlineZSchedulerPlugin._get_cmdlinea  sZ    	GV^^	,	,	3^^C 7""7+'	g7]S 7	.r   c                sJ   \         P                  ! 4       pVP                  4        / pVP                  4        F  p V P                  '       g   V P                  V4      '       d   K/  V P                  V4      pVR ,          pWBV&   RV9   d6   VR,          P                  4        F  pV P                  V4      pWBV&   K  	  K  K  	  V#   \        \        3 dK   pTP                  \        P                  8X  g    TP                  \        P                  8X  d    Rp?K  h Rp?ii ; i)rI   r   N)r   pidstatsreload_threadsr@   rw   r   r   keysOSErrorIOErrorerrnoENOENTESRCH)r   ps	processesprocr   rI   es   &      r   get_processesZSchedulerPlugin.get_processesk  s    ")iikd   T%5%5d%;%;


D
!C
u+CcNDY$$&d#cn '  " 
 G
 ww%,,	
EKK	
s$   (C'ACD">DDD"c                s    V P                   P                  V4      pV P                   P                  V4      pV P                   P                  V4      p\        P                  R W4V3,          4       W$3# )z8Read scheduler policy '%s' and priority '%d' of PID '%d')r   rJ   rF   rU   rg   debug)r   rI   r   	sched_strr	      &&   r   _get_rtZSchedulerPlugin._get_rt  si    ##11#6)##66yA)""//4())FC ! "
	r   c                s   V P                   P                  V4      p\        P                  R WCV3,          4        V P                   P	                  V4      pV P                   P                  V4      pW58  g   W68  d   \        P                  RWEWc3,          4        T P                   P                  YT4       R#   \        \        3 d'   p\        P                  RT,          4        Rp?LQRp?ii ; i  \        \        3 d|   p\        TR4      '       dB   TP                  \        P                  8X  d#   \        P                  RT,          4        Rp?R# \        P                  RY3,          4        Rp?R# Rp?ii ; i)zBSetting scheduler policy to '%s' and priority to '%d' of PID '%d'.z9Priority for %s must be in range %d - %d. '%d' was given.z(Failed to get allowed priority range: %sNr   zAFailed to set scheduling parameters of PID %d, the task vanished.z1Failed to set scheduling parameters of PID %d: %s)r   rF   rg   r   rW   rY   r   SystemErrorr   rO   hasattrr   r   )r   rI   rL   rM   r   Zprio_minZprio_maxr      &&&&    r   _set_rtZSchedulerPlugin._set_rt  sI   ##66u=)))P 
##44U;8##44U;8
oIII		 &&s48	 w	 
997	 
 


 w	 aagg4IIQ   IIA	  s7   A B: C4 :C1C,,C14F AE;E;;F c                sf    VR ,          R,          \         P                  P                  ,          ^ 8g  # )statZflags)r   ZpidstatZ
PF_KTHREADr   r   r   r   r   ZSchedulerPlugin._is_kthread  s%    		!FNN$=$=	=	BBr   c                s    V P                   R 8X  d   R# \        P                  ! V P                   V P                  V4      4      RJ# )rd   FN)rx   research_get_stat_cgroupr   r   r   _process_in_blacklisted_cgroupZ.SchedulerPlugin._process_in_blacklisted_cgroup  s;    	!!R'
	4//1F1Fw1O	PX\	\\r   c           	     s   VP                   p VR ,          R,          R8X  d   \        P                  RV,          4       R# V P                  V4      '       d   \        P                  RV,          4       R# VR ,          P	                  4       '       dT   V P                  V4      '       d   \        P                  RV,          4       R# \        P                  RV,          4       R# \        P                  RW P                  V4      3,          4       \        P                  R	W P                  V4      3,          4       \        P                  R
V\        V P                  P                  V4      4      3,          4       R#   \        \        3 d   pTP                  \        P                   8X  g    TP                  \        P"                  8X  d#   \        P                  RT,          4        Rp?R# \        P%                  RY#3,          4        Rp?R# Rp?i\&        \(        3 d)   p\        P%                  RY#3,          4        Rp?R# Rp?ii ; i)r   ZstateZZz9Affinity of zombie task with PID %d could not be changed.Tz`Affinity of task with PID %d could not be changed, the task was moved into a blacklisted cgroup.z[Affinity of kernel thread with PID %d cannot be changed, the task's affinity mask is fixed.zRAffinity of task with PID %d cannot be changed, the task's affinity mask is fixed.zTask %d cmdline: %szTask %d cgroup: %szTask %d affinity: %sz6Failed to get task info for PID %d, the task vanished.Nz&Failed to get task info for PID %d: %sF)rI   rg   r   r   Zis_bound_to_cpur   rh   r   r   r   listr   rP   r   r   r   r   r   r   r{   KeyError)r   r   rI   r   r   r   _ignore_set_affinity_errorZ*SchedulerPlugin._ignore_set_affinity_error  s   #fog#%III 
))'22IIp fo%%''  YYl	 
  	[[e	 88!S*;*;G*D$EEF88 C)>)>w)G#HHI88"c40E0E0R0RSV0W+X%YYZ 
 7	 ggEKK!7IIF 995x  
 
 (	# 995x  	s[   1F  F  F  6F  F  *F  F  &BF   IAH1HI'I(IIc                s     V P                   V,          pVP                  f   VP
                  f   W$n        W4n        R # R # R #   \         d'    \        T P                  4      pY@P                   T&    L^i ; ir   )r   r   r   r   r   r	   )r   rI   r   r	   params   &&&& r   _store_orig_process_rtZ&SchedulerPlugin._store_orig_process_rt  sn    *$$S)6 &//"9? #: 
 *DII&6#)C *s   A .A43A4c                s   R pVf   Vf   V#  V P                  V4      w  rVVf   TpV P                  WV4       V P                  WV4       V#   \        \        3 d   p\        TR4      '       da   TP                  \        P                  8X  dB   \        P                  RT,          4       YP                  9   d   T P                  T Rp Rp?T# \        P                  RY3,          4        Rp?T# Rp?ii ; i)TNr   z=Failed to read scheduler policy of PID %d, the task vanished.FzcRefusing to set scheduler and priority of PID %d, reading original scheduling parameters failed: %s)r   r   r   r   r   r   r   r   rg   r   r   r   )r   rI   rL   rM   contZ
prev_schedZ	prev_prior   r   r   _tune_process_rtZ SchedulerPlugin._tune_process_rt  s    	$
]t|
;!\\#.JmE<<D!s	: 
+ w	 	aagg4IIM 
&&&		!	!#	&D 
+ IIs	  	+	s   =A C8A,C3C33C8c                s,    \        V4      R ,          R8H  # )r   r   )r   )r   r
   r   r   _is_cgroup_affinityZ#SchedulerPlugin._is_cgroup_affinity  s    	Xr	i	''r   Fc                s    V P                   V,          pVP                  f)   VP
                  f   V'       d	   W$n        R # W$n        R # R # R #   \         d'    \        T P                  4      pY@P                   T&    Lhi ; ir   )r   r   r   r   r
   r   )r   rI   r
   	is_cgroupr   r   r   _store_orig_process_affinityZ,SchedulerPlugin._store_orig_process_affinity  sn    *$$S)6 __!6MO	 "7 
 *DII&6#)C *s   A .A>=A>c                s.   V P                   P                  \        P                  : R \	        V4      : R R: 2RR7      P                  R4       F0  p VP                  R4      ^,          R,          pVR8w  d   Vu # R u # 	  R #   \         d     KD  i ; i)r   r   Tno_error
z:cpuset::r    NNrd   )r   	read_filern   ZPROCFS_MOUNT_POINTr   splitZ
IndexError)r   rI   lr   r   r   _get_cgroup_affinityZ$SchedulerPlugin._get_cgroup_affinity  s     99V-F-FCRZ[hlmsstxya	WWZ #B'Fr\6*s* z 
  		s   'B=BBBc                s    V P                  V4      pV P                  pVR 8w  d
   V: R V: 2pV P                  P                  RV,          \	        V4      RR7       R# )r   z%s/tasksTr   N)r   _cgroup_mount_pointr   write_to_filer   )r   rI   r   paths   &&& r   _set_cgroupZSchedulerPlugin._set_cgroup  sP    %%f-&		!	!$s]6
"4))*t+SX$Gr   c                sp    VR ,          p\        V\        4      '       * ;'       d    \        V4      ^ 8  pW!3# )r   )r   r   r   )r   r   r   r   r   _parse_cgroup_affinityZ&SchedulerPlugin._parse_cgroup_affinity  s3    ":&VT**>>s6{Q)		r   c                s   R pVf   V#  V P                  V4      w  rVV'       d$   V P                  V4      pV P                  W4       M<V P                  V4      pV'       d   V P	                  WrV4      pV P                  W4       V P                  VWu4       V#   \        \        3 d   p\        TR4      '       da   TP                  \        P                  8X  dB   \        P                  RT,          4       YP                  9   d   T P                  T Rp Rp?T# \        P                  RY3,          4        Rp?T# Rp?ii ; i)TNr   z5Failed to read affinity of PID %d, the task vanished.FzLRefusing to set CPU affinity of PID %d, reading original affinity failed: %s)r   r   r   _get_affinity_get_intersect_affinity_set_affinityr   r   r   r   r   r   rg   r   r   r   )	r   rI   r
   	intersectr   r   r   prev_affinityr   s	   &&&&     r   _tune_process_affinityZ&SchedulerPlugin._tune_process_affinity   s3   	$
;44X>I--c2MS!&&s+M,,X 	s%$$S 
+ w	 	aagg4IIE 
&&&		!	!#	&D 
+ II\	  	+	s%   AB !5B E)A,D>D>>Ec                s    V P                  WV4      pV'       g   R # V P                  W4      pV'       d   WP                  9  d   R # W P                  V,          n        R # r   )r   r  r   r   )r   rI   r   rL   rM   r
   r      &&&&&& r   _tune_processZSchedulerPlugin._tune_process?  sL    			s4	0$				$	$S	3$	444	*-3'r   c                s   V P                   P                  V4      pVf&   VR8w  d   \        P                  RV,          4       R#  \	        V4      pW43#   \
         d"    \        P                  RT,          4       Ru # i ; i)Nr   z>Invalid scheduler: %s. Scheduler and priority will be ignored.z=Invalid priority: %s. Scheduler and priority will be ignored.)NN)r   rE   rg   r   rp   r   )r   rD   Zstr_priorityr   r	      &&&  r   _convert_sched_paramsZ%SchedulerPlugin._convert_sched_paramsH  s    ##44]C)=C/99M 
< H
 		  IIM	 s   A )B ?B c                s    VR 8X  d   RpV# V P                  V4      '       d   TpV# V P                  P                  V4      pV'       g   \        P	                  RV,          4       RpV# )r   Nz)Invalid affinity: %s. It will be ignored.)r   r   hex2cpulistrg   r   )r   Zstr_affinityr
   r   r   _convert_affinityZ!SchedulerPlugin._convert_affinityW  so    S8 
/ --8 
/ ii##L18
II9 H	/r   c                s`    Vw  r#rEpV P                  W44      w  r4V P                  V4      pW#WEV3# r   )r  r	  )r   vals	rule_prior   r	   r
   regexs   &&     r   _convert_sched_cfgZ"SchedulerPlugin._convert_sched_cfgd  sA    6:39U449##H-(
E	::r   c                s   V P                   : R V: 2p \        P                  ! V\        P                  4       V P                  P                  V: R R: 2V P                  P                  V P                   : R R: 2RR7      RR7      '       g   \        P                  RV,          4       R# R#   \
         d(   p\        P                  RT: RT: 24        Rp?LRp?ii ; i)r   zUnable to create cgroup '': Nzcpuset.memsTr   z3Unable to initialize 'cpuset.mems ' for cgroup '%s')r   r.   Zmkdirrn   DEF_CGROUP_MODEr   rg   r   r   r   r   )r   r   r   r   r   r   _cgroup_create_groupZ$SchedulerPlugin._cgroup_create_groupk  s    ,,f	5$=88D&(() ))
!
!T="AII4#;#;]KX\] "   	YYDtKL 
 =994;<<=s   %B1 1C#<CC#c                    V P                   e7   V P                   V P                  9   g   V P                  V P                   4       V P                   F  pV P                  V4       K  	  R # r   )r   r   r  r   cgr9   r   _cgroup_initialize_groupsZ)SchedulerPlugin._cgroup_initialize_groupsv  sI    	\\dlldmm&CT\\*MMbR  r   c           	     s   \         P                  R 4        \        P                  ! V P                  \
        P                  4       V P                  P                  RRRRRRV P                  .4      w  r#V^ 8w  d)   \         P                  RV P                  ,          4       R# R#   \         d'   p\         P                  RT,          4        Rp?LRp?ii ; i)	zInitializing cgroups settingsz'Unable to create cgroup mount point: %sNZmountz-tr   z-oZcpusetzUnable to mount '%s')rg   r   r.   Zmakedirsr   rn   r  r   r   r   execute)r   r   retout   &   r   _cgroup_initializeZ"SchedulerPlugin._cgroup_initialize|  s    ))+,<;;t'')?)?@ yy  '448UYUmUm!no*3AX99#d&>&>>?  
 <996:;;<s   /B% %C0CCc                s     \         P                  ! V4       R#   \         d)   p\        P	                  R T: RT: 24        Rp?R# Rp?ii ; i)zUnable to remove directory 'r  N)r.   Zrmdirr   rg   r   )r   r   r   r   r   _remove_dirZSchedulerPlugin._remove_dir  s:    B88F	 B99fa@AABs    AAAc                s4   \        V P                  4       F%  pV P                  V P                  : R V: 24       K'  	  V P                  eL   V P                  V P                  9   g/   V P                  V P                  : R V P                  : 24       R# R# R# )r   N)Zreversedr   r  r   r   r  r9   r   _cgroup_finalize_groupsZ'SchedulerPlugin._cgroup_finalize_groups  sm    T]]#bt77<= $	\\dlldmm&Ct77FG 'Dr   c                s   \         P                  R 4       V P                  P                  RV P                  .4      w  rV^ 8w  d)   \         P                  RV P                  ,          4       R# V P                  V P                  4       \        P                  P                  V P                  4      pVR8w  d   V P                  V4       R# R# )zRemoving cgroups settingsZumountzUnable to umount '%s'Fr   N)
rg   r   r   r  r   r   r  r.   r   Zdirname)r   r  r  Zdr  r   _cgroup_finalizeZ SchedulerPlugin._cgroup_finalize  s    ))'(yy  (D,D,D!EF*3AX99$t'?'??@
4++,ggood../!3hA r   c                s   VR 8w  d    \         P                  RV: RV: R24       M\         P                  RV,          4       R# V P                  : RV: RR: 2pV'       da   V P                  P	                  VRR	R
7      P                  4       pVR8w  d   WPP                  V&   M\         P                  RV,          4       R# V P                  P                  WBR	R7      '       g!   \         P                  RV: RV: R24       R# R# )rd   zSetting cgroup 'z' affinity to ''z.Skipping cgroup '%s', empty affinity requestedNr   cpuset.cpusERRTerr_retr   zIRefusing to set affinity of cgroup '%s', reading original affinity failedr   zUnable to set affinity 'z' for cgroup ')	rg   r   r   r   r   Zstripr   r   r   )r   r   r
   backupr   Zorig_affinity   &&&&  r   _cgroup_set_affinity_oneZ(SchedulerPlugin._cgroup_set_affinity_one  s    ^99vxHI99=FG	//	G$99&&tu&NTTV=u.;##F+IIY\bbc
		 	 D	 	A	A99hOP 
Br   c                s   V P                   '       d   R # \        P                  R4       V P                  eR   V P                  eD   V P                  V P
                  9   g)   V P                  V P                  V P                  RR7       V P
                  P                  4        F%  pV P                  V^ ,          V^,          RR7       K'  	  RV n         R # )NzSetting cgroups affinitiesT)r"  )r   rg   r   r   r   r   r$  r>   r  r9   r   _cgroup_set_affinityZ$SchedulerPlugin._cgroup_set_affinity  s    	&&&	))()	^^DLL$<T\\UYUbUbEb  t~~ MMM!b  A1 = "&*$#r   c                s    \         P                  R 4       V P                  P                  4        F#  pV P	                  V^ ,          V^,          4       K%  	  R# )zRestoring cgroups affinitiesN)rg   r   r   r>   r$  r  r9   r   _cgroup_restore_affinityZ(SchedulerPlugin._cgroup_restore_affinity  s@    ))*+++113b  A1. 4r   c                s 	  < V P                   P                  VP                  R ,          4      V n        V P                  P                  V P                   P                  VP                  R,          4      4      R8H  V n        V P                  P                  V P                   P                  VP                  R,          4      4      R8H  V n        V P                  V P                   P                  VP                  R,          4      4      V n	        V P                  '       d   V P                  4        V P                  '       g   V P                  '       d   V P                  4        \        \        V `;  V4       V P                  4         V P!                  4       pTP*                  P-                  4        UUu. uF"  w  rET\/        T4      P1                  R^4      3NK$  	  pppT UUu. uFH  w  rG\2        P4                  ! RT4      '       g   K$  \7        T4      ^8X  g   K6  Y@P9                  T4      3NKJ  	  ppp\;        TR	 R
7      p\=        4       p	/ Tn        T F  w  pw  rrp \2        P@                  ! T4      pTP-                  4        UUu. uF%  w  pp\2        PB                  ! TT4      f   K!  TT3NK'  	  ppp\=        T UUu. uF  w  ppTTYKYT33NK  	  upp4      pT	PE                  T4       \2        PF                  ! RR\/        T4      4      pYT.TP>                  T&   K  	  T	P-                  4        F  w  pw  prKrpT PI                  TTTY4       K!  	  T PJ                  PM                  T PN                  T PP                  4       T PR                  '       dY   TPT                  '       dE   \V        PX                  ! T PZ                  T.R7      Tn.        TP\                  P_                  4        R# R# R#   \"        \$        3 d(   p\&        P)                  RT,          4        Rp?R# Rp?ii ; iu uppi u uppi   \2        P(                   d2   p\&        P)                  R\/        T4      ,          4        Rp?EK&  Rp?ii ; iu uppi u uppi )r   r   1r   r   Ierror applying tuning, cannot get information about running processes: %sNZ:zgroup\.c                 s"    V ^,          ^ ,          # )r     )Zoption_valsr   r   Z<lambda>Z8SchedulerPlugin._instance_apply_static.<locals>.<lambda>  s    +a.2Cr   )keyz(error compiling regular expression: '%s'z(?<!\\)\((?!\?)z(?:)ZtargetZargs)0r   r   r   r   r   rr   _cgroup_mount_point_init_cgroup_groups_initr   r   r  r  rl   rb   _instance_apply_staticr%  r   r   r   rg   r   r   r>   r   r   r   Zmatchr   r  Zsortedr<   _sched_lookupZcompiler   ZupdateZsubr  r   setr|   r   ro   r   r   ZThread_thread_code_threadZstart)r   r   r   r   r   r   Z	sched_cfgr
  ZbufZ	sched_allr  r   r	   r
   r  r(   rI   r   r   rL   r   s   &&                  r   r-  Z&SchedulerPlugin._instance_apply_static  s    "__33H4D4DEY4Z[$"&))"4"4T__5K5K-.60 #147#8$!YY//0F0F()1+ ,/23$++DOO,B,B/0-2 3$, 
"""	!>!>!>!!#5h?
2
 HPGZGZG`G`GbcGbmfE
((a01Gb)c!	!	xx
F# 
1 	D	Q 
1&))$/	0!  	 SCD)f)( @f?yX


5A ,.88:W:xsC1c9J
c
:9W c VEJK  !5E 66$eSZ85$-#B8%     ?c>CHc3	  --D//	\\\h...&&0A0A8*U8 /\G 7	 
99X	 
	
 d	 (( II83u:EF X sZ   O4 4(P/$!P5
P5P5!P;
R-RR
4P,P''P,;R%Q<<Rc                s    V P                  4       pT P
                  P                  4        F  w  r4Y19  g   Y,          TP                  8w  d   K$  TP                  e5   TP                  e'   T P                  Y4P                  TP                  4       TP                  e   T P                  Y4P                  4       K  TP                  f   K  T P                  Y4P                  4       K  	  / T n        T P                  P!                  T P"                  4       R#   \        \        3 d(   p\        P	                  R T,          4        Rp?R# Rp?ii ; i)zKerror unapplying tuning, cannot get information about running processes: %sN)r   r   r   rg   r   r   r>   r   r   r	   r   r   r   r
   r   r   r   r|   )r   r   r   rI   Zorig_paramss   &    r   r   Z$SchedulerPlugin._restore_ps_affinity  s   
2
 2288:c	mrw+"5"55'				)LL++$S,,-(s001 ;  $--d112# 7	 
99Z	 
	
s   D E+EEc                s   \        \        P                  4      pR pVR8w  d   V^ 8  d   V P                  P	                  V P
                  : RV: RR: 2R RR7      pVR
9  dH   VP                  R4       F2  pV P                  P                  V P
                  : RR: 2VRR7       K4  	  V^,          pK  V^ 8X  d   \        P                  RV,          4       R	# R	# ) rd   r   ZtasksTr   r   r   z(Unable to cleanup tasks from cgroup '%s'N)rd   r2  )
rp   rn   ZCGROUP_CLEANUP_TASKS_RETRYr   r   r   r   r   rg   rh   )r   r   Zcntdatar   r   r   _cgroup_cleanup_tasks_oneZ)SchedulerPlugin._cgroup_cleanup_tasks_one  s    F--.#	$
sQw
))

D,D,DfgVd  $4
)ZZ	YY(@(@'JAZ^_ !83AX;;9FBC r   c                r  r   )r   r   r4  r  r9   r   _cgroup_cleanup_tasksZ%SchedulerPlugin._cgroup_cleanup_tasks  sI    	\\dlldmm&C!!$,,/MMb!!"% r   c                s  < \         \        V `  W4       V P                  '       dG   VP                  '       d5   VP
                  P                  4        VP                  P                  4        V P                  4        V P                  4        V P                  4        V P                  '       g   V P                  '       d   V P                  4        V P                  '       d   V P                  4        R # R # r   )rl   rb   _instance_unapply_staticro   r   r   r/  r1  joinr   r&  r5  r,  r+  r  r  )r   r   Zrollbackr   s   &&&r   r6  Z(SchedulerPlugin._instance_unapply_static"  s    7K	\\\h...!	!>!>!>!	""" #r   c                sZ   \         P                  R V,          4       V P                  : RV: RR: 2pV P                  P	                  VRRR7      pVR8X  d   R# V P                  P                  V P                  P                  V4      4      pV P                  P                  V P                  P                  V4      4      pRV,          pWB8X  d.   \         P                  \        P                  WT3,          4       R# \         P                  \        P                  WTV3,          4       R# )zVerifying cgroup '%s' affinityr   r  r  Tr   zcgroup '%s' affinityF)rg   r   r   r   r   cpulist2stringZcpulist_packr   rn   STR_VERIFY_PROFILE_VALUE_OKr   STR_VERIFY_PROFILE_VALUE_FAIL)r   r   r
   r   current_affinityZaffinity_descriptions   &&&   r   _cgroup_verify_affinity_oneZ+SchedulerPlugin._cgroup_verify_affinity_one/  s    )),v56//	G$YY((4(P
YY--dii.D.DEU.VWYY%%dii&<&<X&FG(/&8!88F../0 1
99V11  r   c                s   \         P                  R 4       RpV P                  eZ   V P                  eL   V P                  V P                  9   g1   T;'       d'    V P                  V P                  V P                  4      pV P                  P                  4        F-  pT;'       d!    V P                  V^ ,          V^,          4      pK/  	  V# )zVeryfying cgroups affinitiesT)rg   r   r   r   r   r<  r>   )r   r  r  r3   r   _cgroup_verify_affinityZ'SchedulerPlugin._cgroup_verify_affinityB  s    ))*+#	^^DLL$<T\\UYUbUbEb		O	O11$,,O3MM!b		?	?11"Q%A?3 "	*r   c                sd   < \         \        V `  WV4      pV P                  4       pT;'       d    T# r   )rl   rb   _instance_verify_staticr=  )r   r   ignore_missingZdevicesZret1Zret2r   s   &&&&  r   r>  Z'SchedulerPlugin._instance_verify_staticK  s1    		=hX_	`$		%	%	'$	$r   c                s4    \         P                  ! V4      pV P                  '       g   V P                  V4      '       d   R # V P	                  V4      pT P                  P                  TP                  YS4      pTe   Y P                   9   gr   \        P                  RYR\#        T4      3,          4       Tw  rp
T P%                  Y%YT
4       T P&                  P)                  T P*                  T P                   4       R # R # R #   \
        \        3 d   pTP                  \        P                  8X  g    TP                  \        P                  8X  d   \        P                  RT,          4       M\        P                  RY&3,          4        R p?R # R p?ii ; i)N3Failed to get cmdline of PID %d, the task vanished.z#Failed to get cmdline of PID %d: %sz-tuning new process '%s' with PID '%d' by '%s')r   r   rw   r   r   r   r   r   r   r   rg   r   r   r   Z	re_lookupr.  r   r   r  r   r/  r|   )r   r   rI   r(   r   r   r   vrL   rM   r
      &&&&       r   _add_pidZSchedulerPlugin._add_pidP  sB   

..
4



D$4$4T$:$:
			3	3 ii(00#9!]3":"::99<#a&?QQREc==T00	 ;] 7	 
gg	5;;IIC  II3	 	
s#   'D D D FA8FFc                s    W P                   9   d\   V P                   V \        P                  R V,          4       V P                  P	                  V P
                  V P                   4       R# R# )z)removed PID %d from the rollback databaseN)r   rg   r   r   r/  r|   )r   r   rI   rS   r   _remove_pidZSchedulerPlugin._remove_pidh  sV    $$$$9983>?==T00	 %r   c                sj   V P                   P                  VP                  4      p\        P                  ! 4       pVP
                  P                  4       pV F  pVP                  V4       K  	  VP                  P                  4       '       Eg   \        VP	                  V P                  R ,          4      4      ^ 8  g   KS  VP                  P                  4       '       d   Ku  RpV'       g   K  RpV P                   EF-  pVP
                  P                  V4      pV'       g   K)  Rp\        V\        P                   4      '       gR   V P"                  '       dh   \        V\        P$                  4      '       dH   VP&                  \        P(                  8X  d)   V P+                  V\-        VP.                  4      V4       K  \        V\        P$                  4      '       g   K  VP&                  \        P0                  8X  g   EK  V P3                  V\-        VP.                  4      4       EK0  	  EKM  R# )i  TFN)r   Zre_lookup_compiler.  selectpollr   r   Zregisterr   Zis_setr   rq   rz   Zread_on_cpur   ry   Z
comm_event_perf_process_fork_valueZ
task_eventr   ZRECORD_FORKrC  rp   ZtidZRECORD_EXITrD  )	r   r   r(   rF  Zfdsr   Zread_eventsZcpuZevent	   &&       r   r0  ZSchedulerPlugin._thread_codeo  sq   
ii!!("8"89!	$ 	##%#b== &&((	$))D((4/
01A5h>Q>Q>X>X>Z>ZK
+[

**3/e	{
UDOO
,
,%%%udoo..JJ$***hEII2udoo..5::AQAQ3Q3uyy>2  )r   r   )
per_devicec                    V'       d   R # V'       dT   VeN   RP                  \        P                  ! R\        V4      4       Uu. uF  pRV,          NK  	  up4      V n        R # R # R # u upi NZ|z(?<!\\);z(%s))r7  r   r   r   rx   r   enablingr   verifyr?  r   rA  r  r   _cgroup_ps_blacklistZ$SchedulerPlugin._cgroup_ps_blacklist  sV     
%#"%((VYZ_V`@a+b@a1FQJJ@a+b"c4 $X+b   A(r   c                rJ  rK  )r7  r   r   r   ru   rL  r  r   ru   ZSchedulerPlugin._ps_whitelist  T     
%#bhh{CPUJ6W!X6W&1**6W!XY4 $X!XrP  r   c                rJ  rK  )r7  r   r   r   rv   rL  r  r   rv   ZSchedulerPlugin._ps_blacklist  rQ  rP  r   c                    V'       d   R # V'       d,   Ve&   V P                   P                  V4      R8H  V n        R # R # R # Nr'  )r   rr   rw   r   rM  r   rN  r?  r      &&&&&&r   rw   Z SchedulerPlugin._kthread_process  s5     
%#99--e4;4 $Xr   r   c                rR  rS  )r   rr   r}   rT  rU  r   r}   ZSchedulerPlugin._irq_process  s5     
%#yy))%0C74 $Xr   r   c                s    V'       d   R # V'       d8   Ve2   VR9   d	   W n         R # V P                  P                  V4      V n         R # R # R # )N)r   ignore)_default_irq_smp_affinity_valuer   cpulist_unpackrT  rU  r   _default_irq_smp_affinityZ)SchedulerPlugin._default_irq_smp_affinity  s?     
%#!!+0(+/99+C+CE+JD(	 $Xr   r   c                rR  rS  )r   rr   rG  rT  rU  r   _perf_process_forkZ"SchedulerPlugin._perf_process_fork  s5     
%##'99#5#5e#<#C4  $Xr   c                sv    V P                   P                  V4      p\        P                  R W!3,          4       V# )zRead affinity '%s' of PID %d)r   rP   rg   r   )r   rI   resr   r   r   ZSchedulerPlugin._get_affinity  s1    **3/#))*cZ78	*r   c                s   \         P                  ! V4      pV P                  V4      '       d   \        P	                  R V,          4       R# \        P	                  RW3,          4        V P
                  P                  W4       R#   \        \        3 dG   pT P                  T4      '       g%   \        P                  RYT3,          4        Rp?R#  Rp?R# Rp?ii ; i)zMNot setting CPU affinity of PID %d, the task belongs to a blacklisted cgroup.Nz'Setting CPU affinity of PID %d to '%s'.z,Failed to set affinity of PID %d to '%s': %s)r   r   r   rg   r   r   rT   r   r   r   r   )r   rI   r
   r   r   r  r   r   ZSchedulerPlugin._set_affinity  s    NN3'	((1199\_bbc	))5GH%%c4 w	 

)
)'
2
2II<	   3s   *B C5CCc                sr    \        V4      P                  \        V4      4      pV'       d   \        V4      # V# r   )r/  Zintersectionr   )r   Z	affinity1Z	affinity2Z	affinity3Zaffr   r   r   Z'SchedulerPlugin._get_intersect_affinity  s-    I##C	N3#
s)	r   c           	     s   TpV P                   '       g*   V Uu. uF  qPP                  V4      '       d   K  VNK  	  ppV Uu. uF:  p\        P                  ! V P                  V P                  V4      4       f   K8  VNK<  	  ppV P                  R8w  dG   V Uu. uF:  p\        P                  ! V P                  V P                  V4      4       e   K8  VNK<  	  pp\        V Uu. uF  qUP                  V3NK  	  up4      pV F  p V P                  Wg,          4      pT P%                  YrRR7      p
T
'       g   K8  YpP&                  9   d   YP&                  T,          n        T'       d   Ki  RYg,          9   g   Kx  T P+                  Yg,          R,          P-                  4       TR4       K  	  R # u upi u upi u upi u upi   \        \        3 d   p	T	P                  \        P                  8X  g    T	P                  \        P                  8X  d   \        P!                  RT,          4       M\        P#                  RYy3,          4        R p	?	EKP  R p	?	ii ; i)Nrd   r@  zARefusing to set affinity of PID %d, failed to get its cmdline: %sT)r  r   )rw   r   r   r   ru   _get_stat_commrv   r<   rI   r   r   r   r   r   r   rg   r   r   r  r   r   _set_all_obj_affinityr@   )r   Zobjsr
   r   ZpslrA  ZpsdrI   r   r   r   rB  r   r]  Z%SchedulerPlugin._set_all_obj_affinity  s   #					4S 0 0 3!!S3	4 	)Cq299T%7%7#' 
C# 	)	2 
&SBIId&8&8	 $ !S3 
&#&#Quuaj#&'#c



CH
%C 
%
%c & 4
	%%%,/S!)
'i38+	hy  ")  
5	)
&& G
 ww%,,	
EKK	YYD	  	YYR
 sA   F/F/5F4<F45F9F9$F>GIA8IIc                sP     VR ,          #   \         \        \        3 d     R# i ; i)Zcgroupsrd   r   r   r   r   r)   r   r   r   Z SchedulerPlugin._get_stat_cgroup  s*    
I,
7H	% 
s    %%c                s^     VR ,          R,          #   \         \        \        3 d     R# i ; i)r   r   rd   r^  r_  r   r   r\  ZSchedulerPlugin._get_stat_comm  s/    
F)F

7H	% 
s    ,,c                s
    \         P                  ! 4       pVP                  4        V P                  VP	                  4       VR 4       R#   \
        \        3 d(   p\        P                  RT,          4        Rp?R# Rp?ii ; i)Fr(  N)	r   r   r   r]  r@   r   r   rg   r   )r   r
   r   r   r   r   _set_ps_affinityZ SchedulerPlugin._set_ps_affinity  sh    
2biik8U;
7	 
99X	 
 

s   AA
 
BA==Bc           	     sJ    V P                   P                  V4      p\        P                  R V: RV: R24       RV,          p\	        VR4      ;_uu_ 4       pVP                  V4       RRR4       ^ #   + '       g   i     ^ # ; i  \        \        3 d   p\        TR4      '       dK   TP                  \        P                  8X  d,   T'       g$   \        P                  RT,          4       R
u Rp?# \        P                  RT: RX: R	T: 24       Ru Rp?# Rp?ii ; i)zSetting SMP affinity of IRQ z to 'r  z/proc/irq/%s/smp_affinitywNr   z/Setting SMP affinity of IRQ %s is not supportedz"Failed to set SMP affinity of IRQ r  i)r   cpulist2hexrg   r   r   writer   r   r   r   ZEIOr   )r   rk   r
   Z	restoringaffinity_hexZfilenamer&   r   r   r   _set_irq_affinityZ!SchedulerPlugin._set_irq_affinity  s    ))''1<99\ )C/8XsqGGL 	
 	

7	 
 aagg2II? III	lA  IsN   AB A4*B 4B	?B B D"8DD/D"5"DD"D"c                sr    V P                   P                  V4      p\        P                  R V,          4       \	        RR4      ;_uu_ 4       pVP                  V4       RRR4       R#   + '       g   i     R# ; i  \        \        3 d)   p\        P                  RX: RT: 24        Rp?R# Rp?ii ; i)z(Setting default SMP IRQ affinity to '%s'/proc/irq/default_smp_affinityra  Nz+Failed to set default SMP IRQ affinity to 'r  )	r   rc  rg   r   r   rd  r   r   r   )r   r
   re  r&   r   r   r   _set_default_irq_affinityZ)SchedulerPlugin._set_default_irq_affinity6  s    ))''1<997 -s33qGGL 	4333
7	 99a  s6   AA= A)A= )A:	4A= :A= =B6B11B6c                sr   \        4       p\        P                  ! 4       pVP                  4        F  p W4,          R ,          p\        P                  RV: RV: R24       T P                  YQT4      p\        T4      \        T4      8X  d   K^  T P                  YFR4      pT^ 8X  d   YRP                  T&   K  TR	8X  g   K  TP                  P                  T4       K  	  V P                  P                  R4      pV P                  P                  V4      pV P                   R8X  d   V P                  WQV4      pMV P                   R8w  d   V P                   pV P                   R8w  d   V P#                  X4       WRn        V P&                  P                  V P(                  V4       R#   \         d     EK  i ; i)
r
   zRead affinity of IRQ '': 'r  Frg  r   rV  Nrb  )r!   r   
interruptsr   rg   r   r   r   r/  rf  r"   r$   Zappendr   r   r  rW  rh  r#   r   r~   )	r   r
   irq_originalr"   rk   r  r   r[  Zprev_affinity_hexrH  r   _set_all_irq_affinityZ%SchedulerPlugin._set_all_irq_affinityA  sn   ,				$YY[cIj)MII	m  ++MXN9	)nM**				63	Qh*cr	$$S) " ii))*JK))''(9:-	))V3++MXN9++x7339	))X5!!),'--D))<8+  s   -F&&F65F6c                sn   V P                   P                  V P                  R 4      pVf   R # VP                  P	                  4        F  w  r#V P                  W#R4       K  	  V P                  R8w  d   VP                  pV P                  V4       V P                   P                  V P                  4       R # )NTrV  )
r   rC   r~   r"   r>   rf  rW  r#   rh  r   )r   rk  rk   r
   r  r   _restore_all_irq_affinityZ)SchedulerPlugin._restore_all_irq_affinity`  s    ""4#8#8$?,	#((..0mc#. 1	))X5""8!!(+--d++,r   c                s   \        V4      P                  \        V4      4      pV'       d.   \        P                  \        P
                  W3,          4       V# \        P                  \        P                  WV3,          4       V# r   )r/  issubsetrg   r   rn   r9  r   r:  )r   irq_descriptioncorrect_affinityr;  r[  r   r   _verify_irq_affinityZ$SchedulerPlugin._verify_irq_affinityk  st    &&s+;'<=#88F..*+ , 
* 99V11  
*r   c                s   V P                   P                  V P                  R 4      p\        P                  ! 4       pRpVP                  4        F  pWcP                  9   d>   V'       d6   RV,          p\        P                  \        P                  V,          4       KP   WF,          R,          p\        P                  RV: RV: R24       RV,          p	V P                  V	VV4      '       g   RpK  K  	  V P                  P                  R	4      p
V P                  P!                  V
4      pV P"                  R
8w  d8   T P                  RYP"                  R8X  d   TMV P"                  4      '       g   RpV#   \         d     EK7  i ; i)NTz-IRQ %s does not support changing SMP affinityr
   zRead SMP affinity of IRQ 'ri  r  zSMP affinity of IRQ %sFrg  rV  zdefault IRQ SMP affinityr   )r   rC   r~   r   rj  r   r$   rg   r   rn   Z STR_VERIFY_PROFILE_VALUE_MISSINGr   rq  r   r   r   r  rW  )r   rp  r?  rk  r"   r[  rk   Zdescriptionr;  ro  Zcurrent_affinity_hexs   &&&        r   _verify_all_irq_affinityZ(SchedulerPlugin._verify_all_irq_affinityw  s\   ""4#8#8$?,				$#YY[c	&&&>ACGKHHV44{BCy,II	  !.4O$$  S	 $ ,,$&YY**+?@	))X5d>W>WXr*N*NRX*X&((?* ?* 
3	*  s   AE66FFr   )rI  r	   c                s`   R pR V n         Ve   \        V P                  P                  V4      4      p\        V P                  4      pVP                  V4      '       d3   \        W,
          4      pV P                  P                  V4      V n         MCV P                  P                  V P                  4      p	\        P                  RV: RV	: R24       V'       g	   V'       d   Vf   R # V'       d&   V P                  '       d   V P                  Wd4      # R# V'       do   V P                  '       d%   V P                  4        RV P                  ,          p
MTp
V P                  V
4       V P                  '       d   V P                  V4       R# V P                  '       d   V P!                  4        R# )Nz#Invalid isolated_cores specified, 'z"' does not match available cores 'r  Tz	cgroup.%s)r   r/  r   rX  rz   rn  r   r8  rg   r   r}   rr  r   r%  r`  rl  rm  )r   rM  r   rN  r?  r   r
   ZisolatedZpresentZstr_cpusZps_affinitys   &&&&&&     r   _isolated_coresZSchedulerPlugin._isolated_cores  sA   ($.
$))**5128_7  G&'HYY--h7DNyy''

3HII	 &h.

((BB

lll,KK%
x( 
 ""$	r   c                s`    VR 8X  d   V: RV: 2pRV,          # V: RV: RV: 2pRV,          # )rd   r   z/sys/kernel/debug/%sr)  )r   prefix	namespaceknobr   r   r   _sched_assembly_pathZ$SchedulerPlugin._sched_assembly_path  s9    r\
%4 
 $	&& 	4
04	$	&&r   c                s    TpVR 8X  d>   V P                   P                  V4      pVe   V'       d   V P                  W#V4      pV# RpV# )rL   rd   )_dict_sched_knob_maprC   rw  )r   r   rt  ru  rv  ZlpathZlknobs   &&&&&  r   _sched_assembly_path2Z%SchedulerPlugin._sched_assembly_path2  sS    
%'$$((.5&&v%@U 
, U	,r   c                s   V: R V: R V: 2pV P                   P                  V4      pV'       g   VR8X  d   V# RV: R V: 2p\        P                  P	                  V4      '       gf   V P                  WV4      p\        P                  P	                  V4      '       g   V P                  WQW#4      pVR8w  d   V P                  f   RV n        WPP                   V&   V# )Z_rd   z/proc/sys/kernel/T)rt   rC   r.   r   Zexistsrw  ry  rs   )r   rt  ru  rv  r*  r   r#  r   _get_sched_knob_pathZ$SchedulerPlugin._get_sched_knob_path  s    i.#		%	%	)	)#	.$	TRZ
; %.	5$			

#
#Ft
<4
''..

%%dIDD
bjT++3!D&*s#	+r   c                s   R pV P                  WV4      pVR8w  dl   V P                  P                  VR R7      pVfK   \        P	                  RV,          4       V P
                  '       d   \        P	                  R4       RV n        V# )Nrd   )r!  zError reading '%s'zUThis may not work with Secure Boot or kernel_lockdown (this hint is logged only once)F)rz  r   r   rg   r   rs   )r   rt  ru  rv  r3  r   r#  r   _get_sched_knobZSchedulerPlugin._get_sched_knob  sv    	$		"	"6d	;$	RZ
))

dd

34
lII"T)*YYfg#T	+r   c                sF   Vf   R # V P                  WV4      pV'       g   \        P                  RV,          4       R # V'       g[   V P                  P	                  YtV'       d   \
        P                  .MRR7      '       g   \        P                  RV: RV: R24       V# )Nz(knob '%s' ignored, unsupported by kernelFr   zError writing value 'z' to 'r  )rz  rg   r   r   r   r   r   r   )r   rt  ru  rv  r   simremover   s   &&&&&&& r   _set_sched_knobZSchedulerPlugin._set_sched_knob  sx    
]
		"	"6d	;$	997$>?
	
))
!
!$!'~U " 4 4YYUDAB	,r   r   c                (    V P                  R RR4      # rd   rL   re   r{  r   r   r   r   _get_sched_min_granularity_nsZ-SchedulerPlugin._get_sched_min_granularity_ns  s    			b'+?	@@r   c                ,    V P                  R RRWV4      # r  r~  r   r   r   r|  r}     &&&&&r   _set_sched_min_granularity_nsZ-SchedulerPlugin._set_sched_min_granularity_ns  s    			b'+?V	TTr   r   c                s$    V P                  V4      # r   )r  r  r   r   _get_sched_base_slice_nsZ(SchedulerPlugin._get_sched_base_slice_ns  s    		+	+H	55r   c                s&    V P                  WW44      # r   )r  r  r  r   _set_sched_base_slice_nsZ(SchedulerPlugin._set_sched_base_slice_ns  s    		+	+ES	IIr   r   c                r  rd   rL   rf   r  r  r   r   _get_sched_latency_nsZ%SchedulerPlugin._get_sched_latency_ns      			b'<	88r   c                r  r  r  r  r  r   _set_sched_latency_nsZ%SchedulerPlugin._set_sched_latency_ns      			b'<V	LLr   r   c                r  rd   rL   rc   r  r  r   r    _get_sched_wakeup_granularity_nsZ0SchedulerPlugin._get_sched_wakeup_granularity_ns  s    			b'+B	CCr   c                r  r  r  r  r  r    _set_sched_wakeup_granularity_nsZ0SchedulerPlugin._set_sched_wakeup_granularity_ns  s    			b'+BEPV	WWr   r   c                r  rd   rL   Ztunable_scalingr  r  r   r   _get_sched_tunable_scalingZ*SchedulerPlugin._get_sched_tunable_scaling  s    			b'+<	==r   c                r  r  r  r  r  r   _set_sched_tunable_scalingZ*SchedulerPlugin._set_sched_tunable_scaling  s    			b'+<e&	QQr   r   c                r  rd   rL   Zmigration_cost_nsr  r  r   r   _get_sched_migration_cost_nsZ,SchedulerPlugin._get_sched_migration_cost_ns  s    			b'+>	??r   c                r  r  r  r  r  r   _set_sched_migration_cost_nsZ,SchedulerPlugin._set_sched_migration_cost_ns#  s    			b'+>F	SSr   r   c                r  rd   rL   Z
nr_migrater  r  r   r   _get_sched_nr_migrateZ%SchedulerPlugin._get_sched_nr_migrate'  r  r   c                r  r  r  r  r  r   _set_sched_nr_migrateZ%SchedulerPlugin._set_sched_nr_migrate+  r  r   r   c                r  rL   numa_balancingZscan_delay_msr  r  r   r   !_get_numa_balancing_scan_delay_msZ1SchedulerPlugin._get_numa_balancing_scan_delay_ms/  s    			g'7	IIr   c                r  r  r  r  r  r   !_set_numa_balancing_scan_delay_msZ1SchedulerPlugin._set_numa_balancing_scan_delay_ms3  s    			g'7%V\	]]r   r   c                r  rL   r  Zscan_period_min_msr  r  r   r   &_get_numa_balancing_scan_period_min_msZ6SchedulerPlugin._get_numa_balancing_scan_period_min_ms7      			g'79M	NNr   c                r  r  r  r  r  r   &_set_numa_balancing_scan_period_min_msZ6SchedulerPlugin._set_numa_balancing_scan_period_min_ms;      			g'79Mu[a	bbr   r   c                r  rL   r  Zscan_period_max_msr  r  r   r   &_get_numa_balancing_scan_period_max_msZ6SchedulerPlugin._get_numa_balancing_scan_period_max_ms?  r  r   c                r  r  r  r  r  r   &_set_numa_balancing_scan_period_max_msZ6SchedulerPlugin._set_numa_balancing_scan_period_max_msC  r  r   r   c                r  rL   r  Zscan_size_mbr  r  r   r    _get_numa_balancing_scan_size_mbZ0SchedulerPlugin._get_numa_balancing_scan_size_mbG  s    			g'7	HHr   c                r  r  r  r  r  r    _set_numa_balancing_scan_size_mbZ0SchedulerPlugin._set_numa_balancing_scan_size_mbK  s    			g'7U[	\\r   )r   r   r   r,  r   r+  rx   r   r   r   rz   ro   rW  r   rm   r}   r~   rw   ri   rG  rv   ru   rt   r   r|   r   rs   rq   )F)mr   r   r   r   r[   rx  rj   r   r   r   r   Zclassmethodr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r	  r  r  r  r  r  r  r  r$  r%  r&  r-  r   r4  r5  rn   ZROLLBACK_SOFTr6  r<  r=  r>  rC  rD  r0  Zcommand_customrO  ru   rv   rw   r}   rY  rZ  r   r   r   r]  r   r\  r`  rf  rh  rl  rm  rq  rr  rs  rw  ry  rz  r{  r~  Zcommand_getr  Zcommand_setr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   Z__classcell__)r   r   s   @@r   rb   rb      s    k\	 2
%6N
.?$B
  8E68C] D,(
	H>.;	M!@BH	Q"+/
:x3,D& :@9M9M &
038 &U;d <d e4Z 5Z e4Z 5Z "7< 8< U38 48 +%@K AK $59D :D
  D
0	9>	-
> !"E" F"H'	 
 ()A *A ()U *U #$6 %6 #$J %J  !9 "9  !M "M +,D -D +,X -X %&> '> %&R 'R '(@ )@ '(T )T  !9 "9  !M "M ,-J .J ,-^ .^ 12O 3O 12c 3c 12O 3O 12c 3c +,I -I +,] -] ]r   rb   )!rd   r   Z
decoratorsZ
tuned.logsZtunedr   Z
subprocessr   ry   ZImportErrorrE  Ztuned.constsrn   r   Ztuned.utils.commandsr   r   r.   r   r   r'   r{   r^   ZlogsrC   rg   Zobjectr   r!   r%   r\   ZPluginrb   r)  r   r   <module>r     s   
    	      )  	   jjnn5f 50F -*V -*^,~ ,>]dkk ]A    s#   B0 B= 0B:9B:=C
C