From c002d93b59cd3576d1d738721060b51dad2b65f2 Mon Sep 17 00:00:00 2001 From: Nitesh Narayan Lal Date: Fri, 22 Jan 2021 11:01:05 -0500 Subject: [PATCH] realtime: added support for netdev_queue_count This allows the user to adjust the queue count for each network device. Also add check_net_queue_count built-in function. The functions check if the user has specified any queue count value or not. If no value is passed the function returns the number of housekeeping CPUs as the queue count. Resolves: rhbz#1846767 Signed-off-by: Nitesh Narayan Lal --- profiles/realtime/realtime-variables.conf | 8 +++++++ profiles/realtime/tuned.conf | 3 +++ .../function_check_net_queue_count.py | 22 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tuned/profiles/functions/function_check_net_queue_count.py diff --git a/profiles/realtime/realtime-variables.conf b/profiles/realtime/realtime-variables.conf index c2da595..9d929e0 100644 --- a/profiles/realtime/realtime-variables.conf +++ b/profiles/realtime/realtime-variables.conf @@ -9,3 +9,11 @@ # kernel supports it. # # isolate_managed_irq=Y +# +# +# Set the desired combined queue count value using the parameter provided +# below. Ideally this should be set to the number of housekeeping CPUs i.e., +# in the example given below it is assumed that the system has 4 housekeeping +# (non-isolated) CPUs. +# +# netdev_queue_count=4 diff --git a/profiles/realtime/tuned.conf b/profiles/realtime/tuned.conf index 8eed36e..2400849 100644 --- a/profiles/realtime/tuned.conf +++ b/profiles/realtime/tuned.conf @@ -35,6 +35,9 @@ assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_exp isolate_managed_irq = ${isolate_managed_irq} managed_irq=${f:regex_search_ternary:${isolate_managed_irq}:\b[y,Y,1,t,T]\b:managed_irq,domain,:} +[net] +channels=combined ${f:check_net_queue_count:${netdev_queue_count}} + [sysctl] kernel.hung_task_timeout_secs = 600 kernel.nmi_watchdog = 0 diff --git a/tuned/profiles/functions/function_check_net_queue_count.py b/tuned/profiles/functions/function_check_net_queue_count.py new file mode 100644 index 0000000..eb54f98 --- /dev/null +++ b/tuned/profiles/functions/function_check_net_queue_count.py @@ -0,0 +1,22 @@ +import tuned.logs +from . import base + +log = tuned.logs.get() + +class check_net_queue_count(base.Function): + """ + Checks whether the user has specified a queue count for net devices. If + not, return the number of housekeeping CPUs. + """ + def __init__(self): + # 1 argument + super(check_net_queue_count, self).__init__("check_net_queue_count", 1, 1) + + def execute(self, args): + if not super(check_net_queue_count, self).execute(args): + return None + if args[0].isdigit(): + return args[0] + (ret, out) = self._cmd.execute(["nproc"]) + log.warn("net-dev queue count is not correctly specified, setting it to HK CPUs %s" % (out)) + return out