Skip to content

Commit

Permalink
Fixed(RPS): some processors have inverted CPU masks so RPS could work…
Browse files Browse the repository at this point in the history
… on foreign NUMA's cpus
  • Loading branch information
strizhechenko committed Oct 28, 2018
1 parent 444d021 commit b9f4337
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions netutils_linux_tuning/auto_softirq_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,31 @@ def cpus2mask(cpus, cpus_count):
bitmap[cpu] = 1
return hex(int(''.join([str(cpu) for cpu in bitmap]), 2))[2:] # no need to write 0x

def cpus_sys_local(self):
cpus_local_file = '/sys/class/net/{0}/device/local_cpus'.format(self.options.dev)
if not os.path.isfile(cpus_local_file):
return
with open(cpus_local_file, 'r') as fd:
return fd.read().strip()

def mask_detect(self):
"""
Finds a way to calculate CPU mask to apply:
1. --cpu-mask
2. --cpus
3. topology.layout
"""
mask = None
if self.options.cpu_mask:
return
if not self.options.cpus:
self.options.cpus = self.cpus_detect_real()
self.options.cpu_mask = self.cpus2mask(self.options.cpus, len(self.topology.socket_layout.keys()))
mask = self.cpus_sys_local()
if mask:
self.options.cpu_mask = mask
else:
self.options.cpus = self.cpus_detect_real()
if not mask:
self.options.cpu_mask = self.cpus2mask(self.options.cpus, len(self.topology.socket_layout.keys()))

def detect_queues_real(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def read(*paths):

setuptools.setup(
name='netutils-linux',
version='2.7.7',
version='2.7.8',
author='Oleg Strizhechenko',
author_email='[email protected]',
license='MIT',
Expand Down

0 comments on commit b9f4337

Please sign in to comment.