Merge pull request #734 from adriaan42/adriaan/scheduler-kthread-switch
plugin_scheduler: add switch to disable processing of kthreads
This commit is contained in:
commit
a96d7d98e9
1 changed files with 19 additions and 1 deletions
|
|
@ -463,6 +463,7 @@ class SchedulerPlugin(base.Plugin):
|
||||||
# default is to whitelist all and blacklist none
|
# default is to whitelist all and blacklist none
|
||||||
self._ps_whitelist = ".*"
|
self._ps_whitelist = ".*"
|
||||||
self._ps_blacklist = ""
|
self._ps_blacklist = ""
|
||||||
|
self._kthread_process = True
|
||||||
self._cgroup_ps_blacklist_re = ""
|
self._cgroup_ps_blacklist_re = ""
|
||||||
# perf is optional, if unavailable, it will be disabled later
|
# perf is optional, if unavailable, it will be disabled later
|
||||||
try:
|
try:
|
||||||
|
|
@ -577,6 +578,7 @@ class SchedulerPlugin(base.Plugin):
|
||||||
"cgroup_ps_blacklist": None,
|
"cgroup_ps_blacklist": None,
|
||||||
"ps_whitelist": None,
|
"ps_whitelist": None,
|
||||||
"ps_blacklist": None,
|
"ps_blacklist": None,
|
||||||
|
"kthread_process": True,
|
||||||
"irq_process": True,
|
"irq_process": True,
|
||||||
"default_irq_smp_affinity": "calc",
|
"default_irq_smp_affinity": "calc",
|
||||||
"perf_mmap_pages": None,
|
"perf_mmap_pages": None,
|
||||||
|
|
@ -614,6 +616,8 @@ class SchedulerPlugin(base.Plugin):
|
||||||
processes = {}
|
processes = {}
|
||||||
for proc in ps.values():
|
for proc in ps.values():
|
||||||
try:
|
try:
|
||||||
|
if not self._kthread_process and self._is_kthread(proc):
|
||||||
|
continue
|
||||||
cmd = self._get_cmdline(proc)
|
cmd = self._get_cmdline(proc)
|
||||||
pid = proc["pid"]
|
pid = proc["pid"]
|
||||||
processes[pid] = cmd
|
processes[pid] = cmd
|
||||||
|
|
@ -1093,6 +1097,9 @@ class SchedulerPlugin(base.Plugin):
|
||||||
|
|
||||||
def _add_pid(self, instance, pid, r):
|
def _add_pid(self, instance, pid, r):
|
||||||
try:
|
try:
|
||||||
|
proc = procfs.process(pid)
|
||||||
|
if not self._kthread_process and self._is_kthread(proc):
|
||||||
|
return
|
||||||
cmd = self._get_cmdline(pid)
|
cmd = self._get_cmdline(pid)
|
||||||
except (OSError, IOError) as e:
|
except (OSError, IOError) as e:
|
||||||
if e.errno == errno.ENOENT \
|
if e.errno == errno.ENOENT \
|
||||||
|
|
@ -1171,6 +1178,14 @@ class SchedulerPlugin(base.Plugin):
|
||||||
if enabling and value is not None:
|
if enabling and value is not None:
|
||||||
self._ps_blacklist = "|".join(["(%s)" % v for v in re.split(r"(?<!\\);", str(value))])
|
self._ps_blacklist = "|".join(["(%s)" % v for v in re.split(r"(?<!\\);", str(value))])
|
||||||
|
|
||||||
|
@command_custom("kthread_process", per_device = False)
|
||||||
|
def _kthread_process(self, enabling, value, verify, ignore_missing, instance):
|
||||||
|
# currently unsupported
|
||||||
|
if verify:
|
||||||
|
return None
|
||||||
|
if enabling and value is not None:
|
||||||
|
self._kthread_process = self._cmd.get_bool(value) == "1"
|
||||||
|
|
||||||
@command_custom("irq_process", per_device = False)
|
@command_custom("irq_process", per_device = False)
|
||||||
def _irq_process(self, enabling, value, verify, ignore_missing, instance):
|
def _irq_process(self, enabling, value, verify, ignore_missing, instance):
|
||||||
# currently unsupported
|
# currently unsupported
|
||||||
|
|
@ -1230,7 +1245,10 @@ class SchedulerPlugin(base.Plugin):
|
||||||
return affinity3
|
return affinity3
|
||||||
|
|
||||||
def _set_all_obj_affinity(self, objs, affinity, threads = False):
|
def _set_all_obj_affinity(self, objs, affinity, threads = False):
|
||||||
psl = [v for v in objs if re.search(self._ps_whitelist,
|
psl = objs
|
||||||
|
if not self._kthread_process:
|
||||||
|
psl = [v for v in psl if not self._is_kthread(v)]
|
||||||
|
psl = [v for v in psl if re.search(self._ps_whitelist,
|
||||||
self._get_stat_comm(v)) is not None]
|
self._get_stat_comm(v)) is not None]
|
||||||
if self._ps_blacklist != "":
|
if self._ps_blacklist != "":
|
||||||
psl = [v for v in psl if re.search(self._ps_blacklist,
|
psl = [v for v in psl if re.search(self._ps_blacklist,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue