summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-03-30 21:30:06 +0100
committerGitHub <noreply@github.com>2024-03-30 21:30:06 +0100
commit89a6299156b86ac838462fd60af196dcb0d8877c (patch)
treeef6c6140587b4975ddb5b61e50e7bc5b93a0dce8 /python
parenta95063831f83dcfe458691b86407b70107b700ad (diff)
parent6927c0b622c8feaece907944bae3d4724f1e55a0 (diff)
downloadvyos-1x-89a6299156b86ac838462fd60af196dcb0d8877c.tar.gz
vyos-1x-89a6299156b86ac838462fd60af196dcb0d8877c.zip
Merge pull request #3218 from dmbaturin/half-cpus
accel-ppp: T6187: use correct CPU counts adjusted for SMT
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdict.py4
-rw-r--r--python/vyos/utils/system.py7
2 files changed, 2 insertions, 9 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 4111d7271..cb9f0cbb8 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -633,7 +633,7 @@ def get_accel_dict(config, base, chap_secrets, with_pki=False):
Return a dictionary with the necessary interface config keys.
"""
- from vyos.utils.system import get_half_cpus
+ from vyos.cpu import get_core_count
from vyos.template import is_ipv4
dict = config.get_config_dict(base, key_mangling=('-', '_'),
@@ -643,7 +643,7 @@ def get_accel_dict(config, base, chap_secrets, with_pki=False):
with_pki=with_pki)
# set CPUs cores to process requests
- dict.update({'thread_count' : get_half_cpus()})
+ dict.update({'thread_count' : get_core_count()})
# we need to store the path to the secrets file
dict.update({'chap_secrets_file' : chap_secrets})
diff --git a/python/vyos/utils/system.py b/python/vyos/utils/system.py
index 5d41c0c05..55813a5f7 100644
--- a/python/vyos/utils/system.py
+++ b/python/vyos/utils/system.py
@@ -79,13 +79,6 @@ def sysctl_apply(sysctl_dict: dict[str, str], revert: bool = True) -> bool:
# everything applied
return True
-def get_half_cpus():
- """ return 1/2 of the numbers of available CPUs """
- cpu = os.cpu_count()
- if cpu > 1:
- cpu /= 2
- return int(cpu)
-
def find_device_file(device):
""" Recurively search /dev for the given device file and return its full path.
If no device file was found 'None' is returned """