public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: jiangshanlai@gmail.com
Cc: linux-kernel@vger.kernel.org, Naohiro.Aota@wdc.com,
	kernel-team@meta.com, Tejun Heo <tj@kernel.org>
Subject: [PATCH 10/10] tools/workqueue/wq_dump.py: Add node_nr/max_active dump
Date: Thu, 25 Jan 2024 07:06:03 -1000	[thread overview]
Message-ID: <20240125170628.2017784-11-tj@kernel.org> (raw)
In-Reply-To: <20240125170628.2017784-1-tj@kernel.org>

Print out per-node nr/max_active numbers to improve visibility into
node_nr_active operations.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 tools/workqueue/wq_dump.py | 41 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/tools/workqueue/wq_dump.py b/tools/workqueue/wq_dump.py
index 333b2fc00b82..bd381511bd9a 100644
--- a/tools/workqueue/wq_dump.py
+++ b/tools/workqueue/wq_dump.py
@@ -50,6 +50,7 @@ import drgn
 from drgn.helpers.linux.list import list_for_each_entry,list_empty
 from drgn.helpers.linux.percpu import per_cpu_ptr
 from drgn.helpers.linux.cpumask import for_each_cpu,for_each_possible_cpu
+from drgn.helpers.linux.nodemask import for_each_node
 from drgn.helpers.linux.idr import idr_for_each
 
 import argparse
@@ -107,7 +108,6 @@ WQ_AFFN_NUMA            = prog['WQ_AFFN_NUMA']
 WQ_AFFN_SYSTEM          = prog['WQ_AFFN_SYSTEM']
 
 WQ_NAME_LEN             = prog['WQ_NAME_LEN'].value_()
-
 cpumask_str_len         = len(cpumask_str(wq_unbound_cpumask))
 
 print('Affinity Scopes')
@@ -205,3 +205,42 @@ print(f'[{"workqueue":^{WQ_NAME_LEN-2}}\\ {"unbound_cpus":{ucpus_len}}    pid {"
     print(f' {wq.rescuer.task.pid.value_():6}', end='')
     print(f' {cpumask_str(wq.rescuer.task.cpus_ptr):{rcpus_len}}', end='')
     print('')
+
+print('')
+print('Unbound workqueue -> node_nr/max_active')
+print('=======================================')
+
+if 'node_to_cpumask_map' in prog:
+    __cpu_online_mask = prog['__cpu_online_mask']
+    node_to_cpumask_map = prog['node_to_cpumask_map']
+    nr_node_ids = prog['nr_node_ids'].value_()
+
+    print(f'online_cpus={cpumask_str(__cpu_online_mask.address_of_())}')
+    for node in for_each_node():
+        print(f'NODE[{node:02}]={cpumask_str(node_to_cpumask_map[node])}')
+    print('')
+
+    print(f'[{"workqueue":^{WQ_NAME_LEN-2}}\\ min max', end='')
+    first = True
+    for node in for_each_node():
+        if first:
+            print(f'  NODE {node}', end='')
+            first = False
+        else:
+            print(f' {node:7}', end='')
+    print(f' {"dfl":>7} ]')
+    print('')
+
+    for wq in list_for_each_entry('struct workqueue_struct', workqueues.address_of_(), 'list'):
+        if not (wq.flags & WQ_UNBOUND):
+            continue
+
+        print(f'{wq.name.string_().decode():{WQ_NAME_LEN}} ', end='')
+        print(f'{wq.min_active.value_():3} {wq.max_active.value_():3}', end='')
+        for node in for_each_node():
+            nna = wq.node_nr_active[node]
+            print(f' {nna.nr.counter.value_():3}/{nna.max.value_():3}', end='')
+        nna = wq.node_nr_active[nr_node_ids]
+        print(f' {nna.nr.counter.value_():3}/{nna.max.value_():3}')
+else:
+    printf(f'node_to_cpumask_map not present, is NUMA enabled?')
-- 
2.43.0


  parent reply	other threads:[~2024-01-25 17:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 17:05 [PATCHSET v3 wq/for-6.9] workqueue: Implement system-wide max_active for unbound workqueues Tejun Heo
2024-01-25 17:05 ` [PATCH 01/10] workqueue: Move pwq->max_active to wq->max_active Tejun Heo
2024-01-25 17:05 ` [PATCH 02/10] workqueue: Factor out pwq_is_empty() Tejun Heo
2024-01-25 17:05 ` [PATCH 03/10] workqueue: Replace pwq_activate_inactive_work() with [__]pwq_activate_work() Tejun Heo
2024-01-25 17:05 ` [PATCH 04/10] workqueue: Move nr_active handling into helpers Tejun Heo
2024-01-25 17:05 ` [PATCH 05/10] workqueue: Make wq_adjust_max_active() round-robin pwqs while activating Tejun Heo
2024-01-25 17:05 ` [PATCH 06/10] workqueue: RCU protect wq->dfl_pwq and implement accessors for it Tejun Heo
2024-01-25 17:06 ` [PATCH 07/10] workqueue: Move pwq_dec_nr_in_flight() to the end of work item handling Tejun Heo
2024-01-25 17:06 ` [PATCH 08/10] workqueue: Introduce struct wq_node_nr_active Tejun Heo
2024-01-29 16:02   ` Lai Jiangshan
2024-01-29 18:14     ` [PATCH v4 " Tejun Heo
2024-01-30 18:00       ` Nathan Chancellor
2024-01-31  4:04         ` Tejun Heo
2024-01-25 17:06 ` [PATCH 09/10] workqueue: Implement system-wide nr_active enforcement for unbound workqueues Tejun Heo
2024-01-29 16:00   ` Lai Jiangshan
2024-01-29 18:14     ` [PATCH v4 " Tejun Heo
2024-01-30 22:30       ` Marek Szyprowski
2024-01-31  4:02         ` Tejun Heo
2024-01-31  4:12           ` Nathan Chancellor
2024-01-31  4:13             ` Tejun Heo
2024-01-31  4:20               ` Nathan Chancellor
2024-01-31  4:24                 ` Tejun Heo
2024-01-31  4:42                   ` Nathan Chancellor
2024-01-31  5:01                     ` Tejun Heo
2024-01-31  7:45                       ` Marek Szyprowski
2024-01-31 21:52                   ` Mark Brown
2024-01-31  5:25           ` [PATCH wq/for-6.9] workqueue: Avoid premature init of wq->node_nr_active[].max Tejun Heo
2024-01-25 17:06 ` Tejun Heo [this message]
2024-01-29 16:07 ` [PATCHSET v3 wq/for-6.9] workqueue: Implement system-wide max_active for unbound workqueues Lai Jiangshan
2024-01-29 18:16   ` Tejun Heo

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=20240125170628.2017784-11-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=Naohiro.Aota@wdc.com \
    --cc=jiangshanlai@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.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