Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin_scheduler: add switch to disable processing of kthreads #734

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion tuned/plugins/plugin_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ def __init__(self, monitor_repository, storage_factory, hardware_inventory, devi
# default is to whitelist all and blacklist none
self._ps_whitelist = ".*"
self._ps_blacklist = ""
self._kthread_process = True
self._cgroup_ps_blacklist_re = ""
# perf is optional, if unavailable, it will be disabled later
try:
Expand Down Expand Up @@ -577,6 +578,7 @@ def _get_config_options(cls):
"cgroup_ps_blacklist": None,
"ps_whitelist": None,
"ps_blacklist": None,
"kthread_process": True,
"irq_process": True,
"default_irq_smp_affinity": "calc",
"perf_mmap_pages": None,
Expand Down Expand Up @@ -614,6 +616,8 @@ def get_processes(self):
processes = {}
for proc in ps.values():
try:
if not self._kthread_process and self._is_kthread(proc):
continue
cmd = self._get_cmdline(proc)
pid = proc["pid"]
processes[pid] = cmd
Expand Down Expand Up @@ -1093,6 +1097,9 @@ def _instance_verify_static(self, instance, ignore_missing, devices):

def _add_pid(self, instance, pid, r):
try:
proc = procfs.process(pid)
if not self._kthread_process and self._is_kthread(proc):
return
cmd = self._get_cmdline(pid)
except (OSError, IOError) as e:
if e.errno == errno.ENOENT \
Expand Down Expand Up @@ -1171,6 +1178,14 @@ def _ps_blacklist(self, enabling, value, verify, ignore_missing, instance):
if enabling and value is not None:
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)
def _irq_process(self, enabling, value, verify, ignore_missing, instance):
# currently unsupported
Expand Down Expand Up @@ -1230,7 +1245,10 @@ def _get_intersect_affinity(self, affinity1, affinity2, affinity3):
return affinity3

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]
if self._ps_blacklist != "":
psl = [v for v in psl if re.search(self._ps_blacklist,
Expand Down
Loading