@@ -446,6 +446,7 @@ def __init__(self, monitor_repository, storage_factory, hardware_inventory, devi
446446 # default is to whitelist all and blacklist none
447447 self ._ps_whitelist = ".*"
448448 self ._ps_blacklist = ""
449+ self ._kthread_process = True
449450 self ._cgroup_ps_blacklist_re = ""
450451 self ._cpus = perf .cpu_map ()
451452 self ._scheduler_storage_key = self ._storage_key (
@@ -550,6 +551,7 @@ def _get_config_options(cls):
550551 "cgroup_ps_blacklist" : None ,
551552 "ps_whitelist" : None ,
552553 "ps_blacklist" : None ,
554+ "kthread_process" : True ,
553555 "irq_process" : True ,
554556 "default_irq_smp_affinity" : "calc" ,
555557 "perf_mmap_pages" : None ,
@@ -586,6 +588,8 @@ def get_processes(self):
586588 processes = {}
587589 for proc in ps .values ():
588590 try :
591+ if not self ._kthread_process and self ._is_kthread (proc ):
592+ continue
589593 cmd = self ._get_cmdline (proc )
590594 pid = proc ["pid" ]
591595 processes [pid ] = cmd
@@ -1059,6 +1063,9 @@ def _instance_verify_static(self, instance, ignore_missing, devices):
10591063
10601064 def _add_pid (self , instance , pid , r ):
10611065 try :
1066+ proc = procfs .process (pid )
1067+ if not self ._kthread_process and self ._is_kthread (proc ):
1068+ return
10621069 cmd = self ._get_cmdline (pid )
10631070 except (OSError , IOError ) as e :
10641071 if e .errno == errno .ENOENT \
@@ -1134,6 +1141,14 @@ def _ps_blacklist(self, enabling, value, verify, ignore_missing):
11341141 if enabling and value is not None :
11351142 self ._ps_blacklist = "|" .join (["(%s)" % v for v in re .split (r"(?<!\\);" , str (value ))])
11361143
1144+ @command_custom ("kthread_process" , per_device = False )
1145+ def _kthread_process (self , enabling , value , verify , ignore_missing ):
1146+ # currently unsupported
1147+ if verify :
1148+ return None
1149+ if enabling and value is not None :
1150+ self ._kthread_process = self ._cmd .get_bool (value ) == "1"
1151+
11371152 @command_custom ("irq_process" , per_device = False )
11381153 def _irq_process (self , enabling , value , verify , ignore_missing ):
11391154 # currently unsupported
@@ -1196,7 +1211,10 @@ def _get_intersect_affinity(self, affinity1, affinity2, affinity3):
11961211 return affinity3
11971212
11981213 def _set_all_obj_affinity (self , objs , affinity , threads = False ):
1199- psl = [v for v in objs if re .search (self ._ps_whitelist ,
1214+ psl = objs
1215+ if not self ._kthread_process :
1216+ psl = [v for v in psl if not self ._is_kthread (v )]
1217+ psl = [v for v in psl if re .search (self ._ps_whitelist ,
12001218 self ._get_stat_comm (v )) is not None ]
12011219 if self ._ps_blacklist != "" :
12021220 psl = [v for v in psl if re .search (self ._ps_blacklist ,
0 commit comments