From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7572F45813; Mon, 19 Aug 2024 13:32:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0658A4028A; Mon, 19 Aug 2024 13:32:27 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id AF94640267 for ; Mon, 19 Aug 2024 13:32:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724067145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EXS1OBqOdsJzMDlj9v+or87QmxwJJHfggkYhKsHELxA=; b=DNHRVViRaLxQ91gEWEF+yV6pIazFuxf0eELDQcx7xQrds6Dlg9gmd4pPhhdWmYnQZkL20j wjbawaUdr6fpPtDC51dxS8BoRnpdFw7hAIDABKFSQpkKzKVfXO7KgxdQHgcEhyOnm424mr VXV4GUNLiZJ11gbcpa5CiqAhEJOd12I= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-byxrMjnvOaKDh7ovLP5eQA-1; Mon, 19 Aug 2024 07:32:21 -0400 X-MC-Unique: byxrMjnvOaKDh7ovLP5eQA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-428fc34f41bso37189885e9.3 for ; Mon, 19 Aug 2024 04:32:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724067140; x=1724671940; h=in-reply-to:references:user-agent:subject:to:from:cc:message-id :date:content-transfer-encoding:mime-version:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EXS1OBqOdsJzMDlj9v+or87QmxwJJHfggkYhKsHELxA=; b=os5xDQtEU8TDtaN4tmKpMl45TNr/uZkkSEWickgOiS3ktPNsAKYktQVn0JEo0OGR0U C4JowwBh64RZIGa5A7aKMxnTpGJsUMvez4Sli+E3xOxQOCU25QWwyKJdnjzkUXzjumwv HhOW3smxRXrSR/gP/09Y61T6NKuMi+sXVtR/7f8w5O7ciliKnYpbFOMiXm7Va72wzV0t RxyCOwhCiDCg1TqHVc1LMWXPW4oMzyUGW1O4GeC4DbtlbB0UN+EKFdjrKhqqVBpJ1K1e ofw6VelMxhSRmKgl5xn3/BCjcwALE0VcCxAdNYLadSTgvcLPpdoi777KmvMdL37KQ27m 6j2g== X-Forwarded-Encrypted: i=1; AJvYcCVMI/iWhNYcbUUL+5UwfP1JCyR1cPFpm/RGpyrVaAxJg6211cPMZmeAi94hsPsvb8OR7h2NkD90HmGUcjo= X-Gm-Message-State: AOJu0Yy98tnSGy48TARNBVAo3uUtED+6zagNZzp9gti5cytQAPHKjGGo Vax2Y/N8HUTsABU3fPRBJpCZ8573P3z9kwNodMWHZqNO5vj63+VQWOig1q5iCSj+JDxFEVAP0jz XwRkVlXttShgbYDQ7IKfRXRfPR1zZEj4g+H3mTehccpGJ+ezUsgw= X-Received: by 2002:a05:600c:198d:b0:428:f0c2:ef4a with SMTP id 5b1f17b1804b1-429ed7baaaamr68602165e9.13.1724067140255; Mon, 19 Aug 2024 04:32:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWoraeSL5M/4AWWtgrIVNBhEzNrTcwjCR6a6dB8H0bqF+MDSFINcpnZ8vY4nFgIdGRaJ7eTw== X-Received: by 2002:a05:600c:198d:b0:428:f0c2:ef4a with SMTP id 5b1f17b1804b1-429ed7baaaamr68601955e9.13.1724067139766; Mon, 19 Aug 2024 04:32:19 -0700 (PDT) Received: from localhost (2a01cb00025433006239e1f47a0b2371.ipv6.abo.wanadoo.fr. [2a01:cb00:254:3300:6239:e1f4:7a0b:2371]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded720eesm160660995e9.33.2024.08.19.04.32.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Aug 2024 04:32:19 -0700 (PDT) Mime-Version: 1.0 Date: Mon, 19 Aug 2024 13:32:18 +0200 Message-Id: Cc: From: "Robin Jarry" To: "Anatoly Burakov" , Subject: Re: [PATCH v2 3/4] usertools/dpdk-hugepages.py: sort by NUMA node User-Agent: aerc/0.18.2-23-g4abdbd4014f5-dirty References: <8f79ca252aac7d47106e6660fb88ad122cd25fcc.1723810613.git.anatoly.burakov@intel.com> In-Reply-To: <8f79ca252aac7d47106e6660fb88ad122cd25fcc.1723810613.git.anatoly.burakov@intel.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 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=20 opportunity to rewrite it. Is this something you'd be willing to work=20 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)) > =20 > =20 > +def get_numa_pages_node(node): > + '''Read list of hugepage reservations on specific NUMA node''' > + hp_path =3D f'/sys/devices/system/node/node{node}/hugepages' > + if not os.path.exists(hp_path): > + return > + res =3D [] > + for pg_sz_dir in os.listdir(hp_path): > + pg_sz =3D int(pg_sz_dir[10:-2]) > + nr_pages =3D get_hugepages(f'{hp_path}/{pg_sz_dir}') > + if nr_pages > 0: > + pg_sz_str =3D fmt_memsize(pg_sz) > + total_sz_str =3D fmt_memsize(nr_pages * pg_sz) > + res +=3D [(nr_pages, pg_sz_str, total_sz_str)] > + else: > + res +=3D [(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 =3D numa_path[29:] # slice after /sys/devices/system/node/= node > - path =3D numa_path + '/hugepages' > - if not os.path.exists(path): > - continue > - for hdir in os.listdir(path): > - pages =3D get_hugepages(path + '/' + hdir) > - if pages > 0: > - kb =3D int(hdir[10:-2]) # slice out of hugepages-NNNkB > - print('{:<4} {:<5} {:<6} {}'.format(node, pages, > - fmt_memsize(kb), > - fmt_memsize(pages * = kb))) > + nodes =3D sorted(int(node[29:]) > + for node in glob.glob('/sys/devices/system/node/node*= ')) > + for node in nodes: > + pg_sz_data =3D 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)) > =20 > =20 > def show_non_numa_pages(): > --=20 > 2.43.5