Skip to content

Commit

Permalink
Merge pull request #3220 from vyos/mergify/bp/sagitta/pr-3218
Browse files Browse the repository at this point in the history
accel-ppp: T6187: use correct CPU counts adjusted for SMT (backport #3218)
  • Loading branch information
c-po authored Mar 31, 2024
2 parents 495bf82 + 92d44fb commit 9edf1e7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions python/vyos/configdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=('-', '_'),
Expand All @@ -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})

Expand Down
7 changes: 0 additions & 7 deletions python/vyos/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down
4 changes: 2 additions & 2 deletions smoketest/scripts/cli/base_accel_ppp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.template import is_ipv4
from vyos.utils.system import get_half_cpus
from vyos.cpu import get_core_count
from vyos.utils.process import process_named_running
from vyos.utils.process import cmd

Expand Down Expand Up @@ -132,7 +132,7 @@ def getConfig(self, start, end="cli"):
return out

def verify(self, conf):
self.assertEqual(conf["core"]["thread-count"], str(get_half_cpus()))
self.assertEqual(conf["core"]["thread-count"], str(get_core_count()))

def test_accel_name_servers(self):
# Verify proper Name-Server configuration for IPv4 and IPv6
Expand Down

0 comments on commit 9edf1e7

Please sign in to comment.