* [PATCH 0/2] slabinfo: parse all NUMA attributes
@ 2020-02-17 8:48 Tobin C. Harding
2020-02-17 8:48 ` [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces Tobin C. Harding
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tobin C. Harding @ 2020-02-17 8:48 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Tobin C. Harding, Andrew Morton, linux-mm, linux-kernel
Hi Christoph,
I found a few files in /sys/kernel/slab/foo/ that contain NUMA info that
is not currently being parsed by `slabinfo.c`. I do not know whether
this is intentional or not? Since I did not know this I just printed
the info in the NUMA report section like is done for the per node slabs
and partial slabs info.
Just for your interest; I found these while re-writing slabinfo in Rust,
thanks to the type-system. I guess that if they were unintentionally
missed then this is a small win, if they were intentionally missed then
this series is just noise :)
Patch one is a one line whitespace fix.
To test I comment out the code that inhibits NUMA output for single node
machines and then the output looks like this (relevant bit at the bottom)
$ sudo slabinfo kmem_cache_node
Slabcache: kmem_cache_node Aliases: 0 Order : 0 Objects: 1877
** Hardware cacheline aligned
Sizes (bytes) Slabs Debug Memory
------------------------------------------------------------------------
Object : 64 Total : 34 Sanity Checks : Off Total: 139264
SlabObj: 64 Full : 15 Redzoning : Off Used : 120128
SlabSiz: 4096 Partial: 17 Poisoning : Off Loss : 19136
Loss : 0 CpuSlab: 2 Tracking : Off Lalig: 0
Align : 64 Objects: 64 Tracing : Off Lpadd: 0
kmem_cache_node has no kmem_cache operations
kmem_cache_node: Kernel object allocation
-----------------------------------------------------------------------
No Data
kmem_cache_node: Kernel object freeing
------------------------------------------------------------------------
No Data
NUMA nodes : 0
---------------------------
All slabs 34
Partial slabs 17
CPU slabs 2
Objects 1.8K
Partial objects 789
Total objects 2.1K
Tobin C. Harding (2):
tools: vm: slabinfo: Replace tabs with spaces
tools: vm: slabinfo: Add numa information for objects
tools/vm/slabinfo.c | 69 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 63 insertions(+), 6 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces
2020-02-17 8:48 [PATCH 0/2] slabinfo: parse all NUMA attributes Tobin C. Harding
@ 2020-02-17 8:48 ` Tobin C. Harding
2020-02-18 16:19 ` Christopher Lameter
2020-02-17 8:48 ` [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects Tobin C. Harding
2020-02-18 16:16 ` [PATCH 0/2] slabinfo: parse all NUMA attributes Christopher Lameter
2 siblings, 1 reply; 7+ messages in thread
From: Tobin C. Harding @ 2020-02-17 8:48 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Tobin C. Harding, Andrew Morton, linux-mm, linux-kernel
We have some rouge tabs within the output string of `slabinfo -h` causing the
description output of the `--partial` option to be incorrectly aligned when
printed.
Replace the tabs with spaces, correctly aligning all option description
strings.
Signed-off-by: Tobin C. Harding <tobin@kernel.org>
---
tools/vm/slabinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c
index 68092d15e12b..29f8ecb59cf6 100644
--- a/tools/vm/slabinfo.c
+++ b/tools/vm/slabinfo.c
@@ -125,7 +125,7 @@ static void usage(void)
"-n|--numa Show NUMA information\n"
"-N|--lines=K Show the first K slabs\n"
"-o|--ops Show kmem_cache_ops\n"
- "-P|--partial Sort by number of partial slabs\n"
+ "-P|--partial Sort by number of partial slabs\n"
"-r|--report Detailed report on single slabs\n"
"-s|--shrink Shrink slabs\n"
"-S|--Size Sort by size\n"
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects
2020-02-17 8:48 [PATCH 0/2] slabinfo: parse all NUMA attributes Tobin C. Harding
2020-02-17 8:48 ` [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces Tobin C. Harding
@ 2020-02-17 8:48 ` Tobin C. Harding
2020-02-18 16:24 ` Christopher Lameter
2020-02-18 16:16 ` [PATCH 0/2] slabinfo: parse all NUMA attributes Christopher Lameter
2 siblings, 1 reply; 7+ messages in thread
From: Tobin C. Harding @ 2020-02-17 8:48 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Tobin C. Harding, Andrew Morton, linux-mm, linux-kernel
Currently we are not handling NUMA information for a bunch of slab
attribute files, files of form `170 N0=170 ...`. These are
objects
objects_partial
total_objects
cpu_slabs
For other attribute files, namely `partial` and `slabs`, we do handle
the NUMA information.
Add a field to the slabinfo struct for the NUMA information and
output it during a NUMA report as is done for `slabs` and `partial`.
reference: /sys/kernel/slab/kmeme_cache_node/
Signed-off-by: Tobin C. Harding <tobin@kernel.org>
---
tools/vm/slabinfo.c | 67 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 62 insertions(+), 5 deletions(-)
diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c
index 29f8ecb59cf6..65254c051da2 100644
--- a/tools/vm/slabinfo.c
+++ b/tools/vm/slabinfo.c
@@ -46,6 +46,10 @@ struct slabinfo {
unsigned long cpu_partial_alloc, cpu_partial_free;
int numa[MAX_NODES];
int numa_partial[MAX_NODES];
+ int numa_objects[MAX_NODES];
+ int numa_objects_partial[MAX_NODES];
+ int numa_total_objects[MAX_NODES];
+ int numa_cpu_slabs[MAX_NODES];
} slabinfo[MAX_SLABS];
struct aliasinfo {
@@ -394,13 +398,49 @@ static void slab_numa(struct slabinfo *s, int mode)
printf("\n");
if (mode) {
printf("%-21s ", "Partial slabs");
- for(node = 0; node <= highest_node; node++) {
+ for (node = 0; node <= highest_node; node++) {
char b[20];
store_size(b, s->numa_partial[node]);
printf(" %4s", b);
}
printf("\n");
+
+ printf("%-21s ", "CPU slabs");
+ for (node = 0; node <= highest_node; node++) {
+ char b[20];
+
+ store_size(b, s->numa_cpu_slabs[node]);
+ printf(" %4s", b);
+ }
+ printf("\n");
+
+ printf("%-21s ", "Objects");
+ for (node = 0; node <= highest_node; node++) {
+ char b[20];
+
+ store_size(b, s->numa_objects[node]);
+ printf(" %4s", b);
+ }
+ printf("\n");
+
+ printf("%-21s ", "Partial objects");
+ for (node = 0; node <= highest_node; node++) {
+ char b[20];
+
+ store_size(b, s->numa_objects_partial[node]);
+ printf(" %4s", b);
+ }
+ printf("\n");
+
+ printf("%-21s ", "Total objects");
+ for (node = 0; node <= highest_node; node++) {
+ char b[20];
+
+ store_size(b, s->numa_total_objects[node]);
+ printf(" %4s", b);
+ }
+ printf("\n");
}
line++;
}
@@ -1205,6 +1245,7 @@ static void read_slab_dir(void)
alias->ref = strdup(p);
alias++;
break;
+
case DT_DIR:
if (chdir(de->d_name))
fatal("Unable to access slab %s\n", slab->name);
@@ -1214,13 +1255,27 @@ static void read_slab_dir(void)
slab->aliases = get_obj("aliases");
slab->align = get_obj("align");
slab->cache_dma = get_obj("cache_dma");
- slab->cpu_slabs = get_obj("cpu_slabs");
+
+ slab->cpu_slabs = get_obj_and_str("cpu_slabs", &t);
+ decode_numa_list(slab->numa_cpu_slabs, t);
+ free(t);
+
slab->destroy_by_rcu = get_obj("destroy_by_rcu");
slab->hwcache_align = get_obj("hwcache_align");
slab->object_size = get_obj("object_size");
- slab->objects = get_obj("objects");
- slab->objects_partial = get_obj("objects_partial");
- slab->objects_total = get_obj("objects_total");
+
+ slab->objects = get_obj_and_str("objects", &t);
+ decode_numa_list(slab->numa_objects, t);
+ free(t);
+
+ slab->objects_partial = get_obj_and_str("objects_partial", &t);
+ decode_numa_list(slab->numa_objects_partial, t);
+ free(t);
+
+ slab->objects_total = get_obj_and_str("total_objects", &t);
+ decode_numa_list(slab->numa_total_objects, t);
+ free(t);
+
slab->objs_per_slab = get_obj("objs_per_slab");
slab->order = get_obj("order");
slab->partial = get_obj("partial");
@@ -1232,9 +1287,11 @@ static void read_slab_dir(void)
slab->red_zone = get_obj("red_zone");
slab->sanity_checks = get_obj("sanity_checks");
slab->slab_size = get_obj("slab_size");
+
slab->slabs = get_obj_and_str("slabs", &t);
decode_numa_list(slab->numa, t);
free(t);
+
slab->store_user = get_obj("store_user");
slab->trace = get_obj("trace");
slab->alloc_fastpath = get_obj("alloc_fastpath");
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] slabinfo: parse all NUMA attributes
2020-02-17 8:48 [PATCH 0/2] slabinfo: parse all NUMA attributes Tobin C. Harding
2020-02-17 8:48 ` [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces Tobin C. Harding
2020-02-17 8:48 ` [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects Tobin C. Harding
@ 2020-02-18 16:16 ` Christopher Lameter
2 siblings, 0 replies; 7+ messages in thread
From: Christopher Lameter @ 2020-02-18 16:16 UTC (permalink / raw)
To: Tobin C. Harding; +Cc: Andrew Morton, linux-mm, linux-kernel
On Mon, 17 Feb 2020, Tobin C. Harding wrote:
> I found a few files in /sys/kernel/slab/foo/ that contain NUMA info that
> is not currently being parsed by `slabinfo.c`. I do not know whether
> this is intentional or not? Since I did not know this I just printed
> the info in the NUMA report section like is done for the per node slabs
> and partial slabs info.
>
> Just for your interest; I found these while re-writing slabinfo in Rust,
> thanks to the type-system. I guess that if they were unintentionally
> missed then this is a small win, if they were intentionally missed then
> this series is just noise :)
It was just to make the display simpler and I did not get around to the
full implementation (by adding some sort of NUMA option) since other
things kept coming up.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces
2020-02-17 8:48 ` [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces Tobin C. Harding
@ 2020-02-18 16:19 ` Christopher Lameter
0 siblings, 0 replies; 7+ messages in thread
From: Christopher Lameter @ 2020-02-18 16:19 UTC (permalink / raw)
To: Tobin C. Harding; +Cc: Andrew Morton, linux-mm, linux-kernel
On Mon, 17 Feb 2020, Tobin C. Harding wrote:
> Replace the tabs with spaces, correctly aligning all option description
> strings.
Acked-by: Christoph Lameter <cl@linux.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects
2020-02-17 8:48 ` [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects Tobin C. Harding
@ 2020-02-18 16:24 ` Christopher Lameter
2020-02-19 20:26 ` Tobin C. Harding
0 siblings, 1 reply; 7+ messages in thread
From: Christopher Lameter @ 2020-02-18 16:24 UTC (permalink / raw)
To: Tobin C. Harding; +Cc: Andrew Morton, linux-mm, linux-kernel
On Mon, 17 Feb 2020, Tobin C. Harding wrote:
> Add a field to the slabinfo struct for the NUMA information and
> output it during a NUMA report as is done for `slabs` and `partial`.
How will this look? Note that there are boxes now with potentially huge
NUMA nodes (AMD Rome can already do 32 with an optimal BIOS layout for
minimal latency).
Maybe make it optional with a --numa switch or so?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects
2020-02-18 16:24 ` Christopher Lameter
@ 2020-02-19 20:26 ` Tobin C. Harding
0 siblings, 0 replies; 7+ messages in thread
From: Tobin C. Harding @ 2020-02-19 20:26 UTC (permalink / raw)
To: Christopher Lameter
Cc: Tobin C. Harding, Andrew Morton, linux-mm, linux-kernel
On Tue, Feb 18, 2020 at 04:24:54PM +0000, Christopher Lameter wrote:
> On Mon, 17 Feb 2020, Tobin C. Harding wrote:
>
> > Add a field to the slabinfo struct for the NUMA information and
> > output it during a NUMA report as is done for `slabs` and `partial`.
>
> How will this look? Note that there are boxes now with potentially huge
> NUMA nodes (AMD Rome can already do 32 with an optimal BIOS layout for
> minimal latency).
>
> Maybe make it optional with a --numa switch or so?
Cool, can do. Thanks for the review.
Tobin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-02-19 20:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 8:48 [PATCH 0/2] slabinfo: parse all NUMA attributes Tobin C. Harding
2020-02-17 8:48 ` [PATCH 1/2] tools: vm: slabinfo: Replace tabs with spaces Tobin C. Harding
2020-02-18 16:19 ` Christopher Lameter
2020-02-17 8:48 ` [PATCH 2/2] tools: vm: slabinfo: Add numa information for objects Tobin C. Harding
2020-02-18 16:24 ` Christopher Lameter
2020-02-19 20:26 ` Tobin C. Harding
2020-02-18 16:16 ` [PATCH 0/2] slabinfo: parse all NUMA attributes Christopher Lameter
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).