Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH] controller: support multi socks to suggest lcores
@ 2019-06-26  5:37 yasufum.o
  0 siblings, 0 replies; only message in thread
From: yasufum.o @ 2019-06-26  5:37 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

From: Yasufumi Ogawa <yasufum.o@gmail.com>

Lcore suggestion of SPP CLI does not care about layout of sockets, so it
possibly suggest a set of lcores on different sockets each other. For
considering optimization, it should be aware of the layout for
suggesting lcores on the same socket.

This update is to select lcores from the same socket if possible.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/controller/commands/pri.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py
index 654b7dd..eaf3d09 100644
--- a/src/controller/commands/pri.py
+++ b/src/controller/commands/pri.py
@@ -159,13 +159,14 @@ class SppPrimary(object):
         """Get lcore usage from spp-ctl for making launch options.
 
         Return value is a double dimension list of unsed lcores.
-          [[2,3,...], [16,17,...]]
+          [[0, 2, 4, ...], [1, 3, 5, ...]]
 
         To get the result, get CPU layout as an list first, then remove
         used lcores from the list.
         """
 
         sockets = []  # A set of CPU sockets.
+
         # Get list of CPU layout
         res = self.spp_ctl_cli.get('cpu_layout')
         if res is not None:
@@ -173,13 +174,14 @@ class SppPrimary(object):
                 try:
                     # Get layout of each of sockets as an array.
                     # [[0,1,2,3,..., 15], [16,17,18],...]]
-                    socket = []
                     for sock in res.json():
+                        socket = []
                         for ent in sock['cores']:
                             socket.append(ent['lcores'])
-                    socket.sort()
-                    socket = sum(socket, [])
-                    sockets.append(socket)
+
+                        socket = sum(socket, [])
+                        socket.sort()
+                        sockets.append(socket)
 
                 except KeyError as e:
                     print('Error: {} is not defined!'.format(e))
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-26  5:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26  5:37 [spp] [PATCH] controller: support multi socks to suggest lcores yasufum.o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).