Skip to content

Commit

Permalink
scheduler: add option for ignoring IRQs affinity
Browse files Browse the repository at this point in the history
This adds the [scheduler] plugin option `irq_process`, which
controls whether the plugin performs any tuning of IRQ affinities.

Resolves: RHEL-21923

Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
  • Loading branch information
adriaan42 committed Feb 7, 2024
1 parent b15de12 commit dee5d6f
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions tuned/plugins/plugin_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ class SchedulerPlugin(base.Plugin):
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
Expand Down Expand Up @@ -444,6 +450,7 @@ def __init__(self, monitor_repository, storage_factory, hardware_inventory, devi
self._cpus = perf.cpu_map()
self._scheduler_storage_key = self._storage_key(
command_name = "scheduler")
self._irq_process = True
self._irq_storage_key = self._storage_key(
command_name = "irq")
self._evlist = None
Expand Down Expand Up @@ -543,6 +550,7 @@ def _get_config_options(cls):
"cgroup_ps_blacklist": None,
"ps_whitelist": None,
"ps_blacklist": None,
"irq_process": True,
"default_irq_smp_affinity": "calc",
"perf_mmap_pages": None,
"perf_process_fork": "false",
Expand Down Expand Up @@ -1126,6 +1134,14 @@ def _ps_blacklist(self, enabling, value, verify, ignore_missing):
if enabling and value is not None:
self._ps_blacklist = "|".join(["(%s)" % v for v in re.split(r"(?<!\\);", str(value))])

@command_custom("irq_process", per_device = False)
def _irq_process(self, enabling, value, verify, ignore_missing):
# currently unsupported
if verify:
return None
if enabling and value is not None:
self._irq_process = self._cmd.get_bool(value) == "1"

@command_custom("default_irq_smp_affinity", per_device = False)
def _default_irq_smp_affinity(self, enabling, value, verify, ignore_missing):
# currently unsupported
Expand Down Expand Up @@ -1374,19 +1390,23 @@ def _isolated_cores(self, enabling, value, verify, ignore_missing):
return None
# currently only IRQ affinity verification is supported
if verify:
return self._verify_all_irq_affinity(affinity, ignore_missing)
if self._irq_process:
return self._verify_all_irq_affinity(affinity, ignore_missing)
return True
elif enabling:
if self._cgroup:
self._cgroup_set_affinity()
ps_affinity = "cgroup.%s" % self._cgroup
else:
ps_affinity = affinity
self._set_ps_affinity(ps_affinity)
self._set_all_irq_affinity(affinity)
if self._irq_process:
self._set_all_irq_affinity(affinity)
else:
# Restoring processes' affinity is done in
# _instance_unapply_static()
self._restore_all_irq_affinity()
if self._irq_process:
self._restore_all_irq_affinity()

def _get_sched_knob_path(self, prefix, namespace, knob):
key = "%s_%s_%s" % (prefix, namespace, knob)
Expand Down

0 comments on commit dee5d6f

Please sign in to comment.