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