From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
Peng Zhang <peng.zhang@corigine.com>,
stable@dpdk.org, Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH v1] buildtools: ensure the NUMA nodes are counted correct
Date: Tue, 2 Aug 2022 15:54:15 +0800 [thread overview]
Message-ID: <1659426855-11014-1-git-send-email-chaoyong.he@corigine.com> (raw)
From: Peng Zhang <peng.zhang@corigine.com>
Sorting a list of strings with the format "node[0-9]+" in order to find the
largest integer by looking at the last item after the sort breaks. But if
there are more then 10 items as a string sort will sort "node10" before
"node2", it will get the error NUMA nodes.
Solve this by sorting the list based on the integer part of the string.
Fixes: 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
buildtools/get-numa-count.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/buildtools/get-numa-count.py b/buildtools/get-numa-count.py
index 1b7787787f..2f243886cd 100644
--- a/buildtools/get-numa-count.py
+++ b/buildtools/get-numa-count.py
@@ -6,11 +6,12 @@
import glob
import os
import subprocess
+import re
if os.name == 'posix':
if os.path.isdir('/sys/devices/system/node'):
numa_nodes = glob.glob('/sys/devices/system/node/node*')
- numa_nodes.sort()
+ numa_nodes.sort(key=lambda l: int(re.findall('\d+', l)[0]))
print(int(os.path.basename(numa_nodes[-1])[4:]) + 1)
else:
subprocess.run(['sysctl', '-n', 'vm.ndomains'], check=False)
--
2.27.0
next reply other threads:[~2022-08-02 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 7:54 Chaoyong He [this message]
2022-08-29 10:41 ` Thomas Monjalon
[not found] ` <MWHPR1301MB1997EA5A5CF4A320A13493E4EF769@MWHPR1301MB1997.namprd13.prod.outlook.com>
[not found] ` <3155813.0WQXIW03uk@thomas>
2022-08-30 2:32 ` Nole Zhang
2022-09-22 8:06 ` [PATCH v2] " Niklas Söderlund
2022-10-10 7:52 ` Niklas Söderlund
2022-10-10 23:11 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1659426855-11014-1-git-send-email-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=niklas.soderlund@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).