Skip to content

Commit

Permalink
Autotune softirq (#132)
Browse files Browse the repository at this point in the history
* Moved common logic from autorps to auto_softirq_tune and inherit autorps/autoxps from it.
* Fixed: hardcoded queue prefix in auto_softirq_tune led to broken autoxps.
  • Loading branch information
strizhechenko committed Jul 12, 2017
1 parent d2149a1 commit 1e9269f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
4 changes: 2 additions & 2 deletions netutils_linux_tuning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"""
from netutils_linux_tuning.rx_buffers import RxBuffersTune
from netutils_linux_tuning.rss_ladder import RSSLadder
from netutils_linux_tuning.autorps import AutoRPS
from netutils_linux_tuning.auto_softirq_tune import AutoRPS, AutoXPS

__all__ = ['RxBuffersTune', 'AutoRPS', 'RSSLadder']
__all__ = ['RxBuffersTune', 'AutoRPS', 'AutoXPS', 'RSSLadder']
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
""" Receive Packet Steering tuning utility """
""" Transmit Packet Steering tuning utility """

import os

from six import print_
Expand All @@ -8,11 +9,11 @@
from netutils_linux_tuning.base_tune import CPUBasedTune


class AutoRPS(CPUBasedTune):
class AutoSoftirqTune(CPUBasedTune):
""" Allows to use multi-cpu packets processing for budget NICs """
numa = None
target = 'rps_cpus'
queue_prefix = 'rx'
target = None
queue_prefix = None

def __init__(self):
CPUBasedTune.__init__(self)
Expand Down Expand Up @@ -87,7 +88,7 @@ def detect_queues_real(self):
:return: queue list to write cpu mask found by really reading /sys/
"""
queue_dir = "/sys/class/net/{0}/queues/".format(self.options.dev)
return [queue for queue in os.listdir(queue_dir) if queue.startswith('rx')]
return [queue for queue in os.listdir(queue_dir) if queue.startswith(self.queue_prefix)]

def lscpu(self):
"""
Expand All @@ -98,3 +99,15 @@ def lscpu(self):
lscpu_output_filename = os.path.join(self.options.test_dir, "lscpu_output")
lscpu_output = open(lscpu_output_filename).read()
return str(lscpu_output) if isinstance(lscpu_output, bytes) else lscpu_output


class AutoXPS(AutoSoftirqTune):
""" Allows to use multi-cpu packets processing for budget NICs """
target = 'xps_cpus'
queue_prefix = 'tx'


class AutoRPS(AutoSoftirqTune):
""" Allows to use multi-cpu packets processing for budget NICs """
target = 'rps_cpus'
queue_prefix = 'rx'
2 changes: 1 addition & 1 deletion netutils_linux_tuning/autorps_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from unittest import TestCase

from netutils_linux_tuning.autorps import AutoRPS
from netutils_linux_tuning.auto_softirq_tune import AutoRPS


class AutoRPSTests(TestCase):
Expand Down
14 changes: 0 additions & 14 deletions netutils_linux_tuning/autoxps.py

This file was deleted.

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

setuptools.setup(
name='netutils-linux',
version='2.2.4',
version='2.2.5',
author='Oleg Strizhechenko',
author_email='oleg.strizhechenko@gmail.com',
license='MIT',
Expand Down
2 changes: 1 addition & 1 deletion utils/autorps
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# coding=utf-8

from netutils_linux_tuning.autorps import AutoRPS
from netutils_linux_tuning.auto_softirq_tune import AutoRPS

if __name__ == '__main__':
AutoRPS()
2 changes: 1 addition & 1 deletion utils/autoxps
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# coding=utf-8

from netutils_linux_tuning.autoxps import AutoXPS
from netutils_linux_tuning.auto_softirq_tune import AutoXPS

if __name__ == '__main__':
AutoXPS()

0 comments on commit 1e9269f

Please sign in to comment.