From: "Robin Jarry" <rjarry@redhat.com>
To: "Anatoly Burakov" <anatoly.burakov@intel.com>, <dev@dpdk.org>
Cc: <bruce.richardson@intel.com>
Subject: Re: [PATCH v2 3/4] usertools/dpdk-hugepages.py: sort by NUMA node
Date: Mon, 19 Aug 2024 13:32:18 +0200 [thread overview]
Message-ID: <D3JUSLL4EX11.I1RGEOXI8WZE@redhat.com> (raw)
In-Reply-To: <8f79ca252aac7d47106e6660fb88ad122cd25fcc.1723810613.git.anatoly.burakov@intel.com>
Anatoly Burakov, Aug 16, 2024 at 14:16:
> Currently, the list of per-NUMA node hugepages is displayed in glob order,
> which can be arbitrary. Fix it to sort the glob order.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Hey Anatoly,
I mean no offense to anyone but dpdk-hugepages.py is really ugly :(
Is this script really needed? If it is, maybe it would be a good
opportunity to rewrite it. Is this something you'd be willing to work
on?
> ---
> usertools/dpdk-hugepages.py | 40 ++++++++++++++++++++++++++-----------
> 1 file changed, 28 insertions(+), 12 deletions(-)
>
> diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py
> index bf2575ba36..54232ddf22 100755
> --- a/usertools/dpdk-hugepages.py
> +++ b/usertools/dpdk-hugepages.py
> @@ -74,21 +74,37 @@ def set_hugepages(path, reqpages):
> gotpages, reqpages, filename))
>
>
> +def get_numa_pages_node(node):
> + '''Read list of hugepage reservations on specific NUMA node'''
> + hp_path = f'/sys/devices/system/node/node{node}/hugepages'
> + if not os.path.exists(hp_path):
> + return
> + res = []
> + for pg_sz_dir in os.listdir(hp_path):
> + pg_sz = int(pg_sz_dir[10:-2])
> + nr_pages = get_hugepages(f'{hp_path}/{pg_sz_dir}')
> + if nr_pages > 0:
> + pg_sz_str = fmt_memsize(pg_sz)
> + total_sz_str = fmt_memsize(nr_pages * pg_sz)
> + res += [(nr_pages, pg_sz_str, total_sz_str)]
> + else:
> + res += [(0, None, None)]
> + return res
> +
> +
> def show_numa_pages():
> '''Show huge page reservations on Numa system'''
> + # get list of NUMA nodes and sort them by integer order
> print('Node Pages Size Total')
> - for numa_path in glob.glob('/sys/devices/system/node/node*'):
> - node = numa_path[29:] # slice after /sys/devices/system/node/node
> - path = numa_path + '/hugepages'
> - if not os.path.exists(path):
> - continue
> - for hdir in os.listdir(path):
> - pages = get_hugepages(path + '/' + hdir)
> - if pages > 0:
> - kb = int(hdir[10:-2]) # slice out of hugepages-NNNkB
> - print('{:<4} {:<5} {:<6} {}'.format(node, pages,
> - fmt_memsize(kb),
> - fmt_memsize(pages * kb)))
> + nodes = sorted(int(node[29:])
> + for node in glob.glob('/sys/devices/system/node/node*'))
> + for node in nodes:
> + pg_sz_data = get_numa_pages_node(node)
> + for nr_pages, pg_sz, total_sz in pg_sz_data:
> + if not nr_pages:
> + continue
> + print('{:<4} {:<5} {:<6} {}'
> + .format(node, nr_pages, pg_sz, total_sz))
>
>
> def show_non_numa_pages():
> --
> 2.43.5
next prev parent reply other threads:[~2024-08-19 11:32 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 11:19 [PATCH v1 1/2] usertools/cpu_layout: update coding style Anatoly Burakov
2024-08-14 11:19 ` [PATCH v1 2/2] usertools/cpu_layout: print out NUMA nodes Anatoly Burakov
2024-08-16 12:16 ` [PATCH v2 1/4] usertools/cpu_layout: update coding style Anatoly Burakov
2024-08-16 12:16 ` [PATCH v2 2/4] usertools/cpu_layout: print out NUMA nodes Anatoly Burakov
2024-08-19 11:23 ` Robin Jarry
2024-08-16 12:16 ` [PATCH v2 3/4] usertools/dpdk-hugepages.py: sort by NUMA node Anatoly Burakov
2024-08-16 12:21 ` Burakov, Anatoly
2024-08-19 11:32 ` Robin Jarry [this message]
2024-08-20 9:04 ` Burakov, Anatoly
2024-08-20 9:06 ` Robin Jarry
2024-08-16 12:16 ` [PATCH v2 4/4] usertools/dpdk-devbind: print " Anatoly Burakov
2024-08-19 11:34 ` Robin Jarry
2024-08-20 9:08 ` Burakov, Anatoly
2024-08-20 9:28 ` Robin Jarry
2024-08-20 9:40 ` Burakov, Anatoly
2024-08-20 9:49 ` Robin Jarry
2024-08-20 9:56 ` Burakov, Anatoly
2024-08-20 10:00 ` Robin Jarry
2024-08-19 11:11 ` [PATCH v2 1/4] usertools/cpu_layout: update coding style Robin Jarry
2024-08-20 9:12 ` Burakov, Anatoly
2024-08-20 9:20 ` Robin Jarry
2024-08-20 9:31 ` Burakov, Anatoly
2024-08-20 9:45 ` Robin Jarry
2024-08-20 9:56 ` Burakov, Anatoly
2024-08-19 9:26 ` [PATCH v1 1/2] " Robin Jarry
2024-08-19 9:36 ` Burakov, Anatoly
2024-08-19 15:13 ` Stephen Hemminger
2024-08-20 15:35 ` [PATCH v3 1/4] " Anatoly Burakov
2024-08-20 15:35 ` [PATCH v3 2/4] usertools/cpu_layout: print out NUMA nodes Anatoly Burakov
2024-08-20 19:22 ` Robin Jarry
2024-08-21 8:49 ` Burakov, Anatoly
2024-08-20 15:35 ` [PATCH v3 3/4] usertools/dpdk-hugepages.py: update coding style Anatoly Burakov
2024-08-20 15:52 ` Stephen Hemminger
2024-08-21 8:53 ` Burakov, Anatoly
2024-08-20 15:57 ` Robin Jarry
2024-08-21 8:52 ` Burakov, Anatoly
2024-08-21 9:06 ` Burakov, Anatoly
2024-08-21 9:16 ` Burakov, Anatoly
2024-08-21 9:22 ` Robin Jarry
2024-08-20 15:35 ` [PATCH v3 4/4] usertools/dpdk-devbind: print NUMA node Anatoly Burakov
2024-08-20 15:59 ` [PATCH v3 1/4] usertools/cpu_layout: update coding style Robin Jarry
2024-08-21 8:49 ` Burakov, Anatoly
2024-08-21 9:22 ` [PATCH v4 " Anatoly Burakov
2024-08-21 9:22 ` [PATCH v4 2/4] usertools/cpu_layout: print out NUMA nodes Anatoly Burakov
2024-08-21 9:22 ` [PATCH v4 3/4] usertools/dpdk-hugepages.py: update coding style Anatoly Burakov
2024-08-21 9:26 ` Robin Jarry
2024-08-21 9:39 ` Burakov, Anatoly
2024-08-21 9:22 ` [PATCH v4 4/4] usertools/dpdk-devbind: print NUMA node Anatoly Burakov
2024-08-21 9:44 ` [PATCH v5 1/4] usertools/cpu_layout: update coding style Anatoly Burakov
2024-08-21 9:44 ` [PATCH v5 2/4] usertools/cpu_layout: print out NUMA nodes Anatoly Burakov
2024-08-21 11:43 ` Robin Jarry
2024-08-21 9:44 ` [PATCH v5 3/4] usertools/dpdk-hugepages.py: update coding style Anatoly Burakov
2024-08-21 11:43 ` Robin Jarry
2024-08-21 9:44 ` [PATCH v5 4/4] usertools/dpdk-devbind: print NUMA node Anatoly Burakov
2024-08-21 11:44 ` Robin Jarry
2024-08-21 10:16 ` [PATCH v5 1/4] usertools/cpu_layout: update coding style Robin Jarry
2024-08-22 10:38 ` [PATCH v6 " Anatoly Burakov
2024-08-22 10:38 ` [PATCH v6 2/4] usertools/cpu_layout: print out NUMA nodes Anatoly Burakov
2024-08-22 17:43 ` Robin Jarry
2024-08-22 10:38 ` [PATCH v6 3/4] usertools/dpdk-hugepages.py: update coding style Anatoly Burakov
2024-08-22 10:38 ` [PATCH v6 4/4] usertools/dpdk-devbind: print NUMA node Anatoly Burakov
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=D3JUSLL4EX11.I1RGEOXI8WZE@redhat.com \
--to=rjarry@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@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).