linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmstat: Add order's information for extfrag_index and unusable_index
@ 2024-02-28 11:48 Hao Ge
  0 siblings, 0 replies; 3+ messages in thread
From: Hao Ge @ 2024-02-28 11:48 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, gehao618, Hao Ge

Current cat /sys/kernel/debug/extfrag/extfrag_index and
/sys/kernel/debug/extfrag/unusable_index is not friendly to userspace.

We should add order's information so that users can clearly understand
the situation of each order at a glance like pagetypeinfo.

before:
cat /sys/kernel/debug/extfrag/extfrag_index:
Node 0, zone    DMA32 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
Node 0, zone   Normal -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...

cat /sys/kernel/debug/extfrag/unusable_index:
Node 0, zone    DMA32 0.000 0.000 0.000 0.000 0.001 0.003 0.007 ...
Node 0, zone   Normal 0.000 0.053 0.106 0.159 0.205 0.244 0.265 ...

after:
cat /sys/kernel/debug/extfrag/extfrag_index:
Extfrag index at order:      0      1      2      3      4      5 ...
Node 0, zone        DMA -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
Node 0, zone     Normal -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...

cat /sys/kernel/debug/extfrag/unusable_index:
Unusable index at order:     0     1     2     3     4     5 ...
Node 0, zone         DMA 0.000 0.030 0.059 0.085 0.096 0.102 ...
Node 0, zone      Normal 0.000 0.225 0.427 0.569 0.776 0.827 ...

Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 mm/vmstat.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index db79935e4a54..fe0b811e9d7f 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -2178,7 +2178,7 @@ static void unusable_show_print(struct seq_file *m,
 	int index;
 	struct contig_page_info info;
 
-	seq_printf(m, "Node %d, zone %8s ",
+	seq_printf(m, "Node %d, zone %11s ",
 				pgdat->node_id,
 				zone->name);
 	for (order = 0; order < NR_PAGE_ORDERS; ++order) {
@@ -2201,12 +2201,19 @@ static void unusable_show_print(struct seq_file *m,
  */
 static int unusable_show(struct seq_file *m, void *arg)
 {
+	int order;
 	pg_data_t *pgdat = (pg_data_t *)arg;
 
 	/* check memoryless node */
 	if (!node_state(pgdat->node_id, N_MEMORY))
 		return 0;
 
+	/* Print header */
+	seq_printf(m, "%s ", "Unusable index at order:");
+	for (order = 0; order < NR_PAGE_ORDERS; ++order)
+		seq_printf(m, "%5d ", order);
+	seq_putc(m, '\n');
+
 	walk_zones_in_node(m, pgdat, true, false, unusable_show_print);
 
 	return 0;
@@ -2230,7 +2237,7 @@ static void extfrag_show_print(struct seq_file *m,
 	/* Alloc on stack as interrupts are disabled for zone walk */
 	struct contig_page_info info;
 
-	seq_printf(m, "Node %d, zone %8s ",
+	seq_printf(m, "Node %d, zone %10s ",
 				pgdat->node_id,
 				zone->name);
 	for (order = 0; order < NR_PAGE_ORDERS; ++order) {
@@ -2247,8 +2254,15 @@ static void extfrag_show_print(struct seq_file *m,
  */
 static int extfrag_show(struct seq_file *m, void *arg)
 {
+	int order;
 	pg_data_t *pgdat = (pg_data_t *)arg;
 
+	/* Print header */
+	seq_printf(m, "%s ", "Extfrag index at order:");
+	for (order = 0; order < NR_PAGE_ORDERS; ++order)
+		seq_printf(m, "%6d ", order);
+	seq_putc(m, '\n');
+
 	walk_zones_in_node(m, pgdat, true, false, extfrag_show_print);
 
 	return 0;
-- 
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/vmstat: Add order's information for extfrag_index and unusable_index
  2024-02-28 11:33 Hao Ge
@ 2024-02-28 11:43 ` Hao Ge
  0 siblings, 0 replies; 3+ messages in thread
From: Hao Ge @ 2024-02-28 11:43 UTC (permalink / raw)
  To: Hao Ge; +Cc: akpm, linux-mm, linux-kernel

Please ignore this patch because I forgot to use checkpatch.pl to check for formatting issues. I will fix it and resend a new one,Sorry to bother you.

> On Feb 28, 2024, at 19:33, Hao Ge <gehao@kylinos.cn> wrote:
> 
> Current cat /sys/kernel/debug/extfrag/extfrag_index and
> /sys/kernel/debug/extfrag/unusable_index is not friendly to userspace.
> 
> We should add order's information so that users can clearly understand
> the situation of each order at a glance like pagetypeinfo.
> 
> befor:
> cat /sys/kernel/debug/extfrag/extfrag_index:
> Node 0, zone    DMA32 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
> Node 0, zone   Normal -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
> 
> cat /sys/kernel/debug/extfrag/unusable_index:
> Node 0, zone    DMA32 0.000 0.000 0.000 0.000 0.001 0.003 0.007 ...
> Node 0, zone   Normal 0.000 0.053 0.106 0.159 0.205 0.244 0.265 ...
> 
> after:
> cat /sys/kernel/debug/extfrag/extfrag_index:
> Extfrag index at order:      0      1      2      3      4      5 ...
> Node 0, zone        DMA -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
> Node 0, zone     Normal -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
> 
> cat /sys/kernel/debug/extfrag/unusable_index:
> Unusable index at order:     0     1     2     3     4     5 ...
> Node 0, zone         DMA 0.000 0.030 0.059 0.085 0.096 0.102 ...
> Node 0, zone      Normal 0.000 0.225 0.427 0.569 0.776 0.827 ...
> 
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
> mm/vmstat.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index db79935e4a54..f604d91e904c 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -2178,7 +2178,7 @@ static void unusable_show_print(struct seq_file *m,
>    int index;
>    struct contig_page_info info;
> 
> -    seq_printf(m, "Node %d, zone %8s ",
> +    seq_printf(m, "Node %d, zone %11s ",
>                pgdat->node_id,
>                zone->name);
>    for (order = 0; order < NR_PAGE_ORDERS; ++order) {
> @@ -2201,12 +2201,19 @@ static void unusable_show_print(struct seq_file *m,
>  */
> static int unusable_show(struct seq_file *m, void *arg)
> {
> +    int order;
>    pg_data_t *pgdat = (pg_data_t *)arg;
> 
>    /* check memoryless node */
>    if (!node_state(pgdat->node_id, N_MEMORY))
>        return 0;
> 
> +    /* Print header */
> +        seq_printf(m, "%s ", "Unusable index at order:");
> +        for (order = 0; order < NR_PAGE_ORDERS; ++order)
> +                seq_printf(m, "%5d ", order);
> +        seq_putc(m, '\n');
> +
>    walk_zones_in_node(m, pgdat, true, false, unusable_show_print);
> 
>    return 0;
> @@ -2230,7 +2237,7 @@ static void extfrag_show_print(struct seq_file *m,
>    /* Alloc on stack as interrupts are disabled for zone walk */
>    struct contig_page_info info;
> 
> -    seq_printf(m, "Node %d, zone %8s ",
> +    seq_printf(m, "Node %d, zone %10s ",
>                pgdat->node_id,
>                zone->name);
>    for (order = 0; order < NR_PAGE_ORDERS; ++order) {
> @@ -2247,8 +2254,15 @@ static void extfrag_show_print(struct seq_file *m,
>  */
> static int extfrag_show(struct seq_file *m, void *arg)
> {
> +    int order;
>    pg_data_t *pgdat = (pg_data_t *)arg;
> 
> +    /* Print header */
> +    seq_printf(m, "%s ", "Extfrag index at order:");
> +    for (order = 0; order < NR_PAGE_ORDERS; ++order)
> +        seq_printf(m, "%6d ", order);
> +    seq_putc(m, '\n');
> +
>    walk_zones_in_node(m, pgdat, true, false, extfrag_show_print);
> 
>    return 0;
> -- 
> 2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mm/vmstat: Add order's information for extfrag_index and unusable_index
@ 2024-02-28 11:33 Hao Ge
  2024-02-28 11:43 ` Hao Ge
  0 siblings, 1 reply; 3+ messages in thread
From: Hao Ge @ 2024-02-28 11:33 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, gehao618, Hao Ge

Current cat /sys/kernel/debug/extfrag/extfrag_index and
/sys/kernel/debug/extfrag/unusable_index is not friendly to userspace.

We should add order's information so that users can clearly understand
the situation of each order at a glance like pagetypeinfo.

befor:
cat /sys/kernel/debug/extfrag/extfrag_index:
Node 0, zone    DMA32 -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
Node 0, zone   Normal -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...

cat /sys/kernel/debug/extfrag/unusable_index:
Node 0, zone    DMA32 0.000 0.000 0.000 0.000 0.001 0.003 0.007 ...
Node 0, zone   Normal 0.000 0.053 0.106 0.159 0.205 0.244 0.265 ...

after:
cat /sys/kernel/debug/extfrag/extfrag_index:
Extfrag index at order:      0      1      2      3      4      5 ...
Node 0, zone        DMA -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...
Node 0, zone     Normal -1.000 -1.000 -1.000 -1.000 -1.000 -1.000 ...

cat /sys/kernel/debug/extfrag/unusable_index:
Unusable index at order:     0     1     2     3     4     5 ...
Node 0, zone         DMA 0.000 0.030 0.059 0.085 0.096 0.102 ...
Node 0, zone      Normal 0.000 0.225 0.427 0.569 0.776 0.827 ...

Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 mm/vmstat.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index db79935e4a54..f604d91e904c 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -2178,7 +2178,7 @@ static void unusable_show_print(struct seq_file *m,
 	int index;
 	struct contig_page_info info;
 
-	seq_printf(m, "Node %d, zone %8s ",
+	seq_printf(m, "Node %d, zone %11s ",
 				pgdat->node_id,
 				zone->name);
 	for (order = 0; order < NR_PAGE_ORDERS; ++order) {
@@ -2201,12 +2201,19 @@ static void unusable_show_print(struct seq_file *m,
  */
 static int unusable_show(struct seq_file *m, void *arg)
 {
+	int order;
 	pg_data_t *pgdat = (pg_data_t *)arg;
 
 	/* check memoryless node */
 	if (!node_state(pgdat->node_id, N_MEMORY))
 		return 0;
 
+	/* Print header */
+        seq_printf(m, "%s ", "Unusable index at order:");
+        for (order = 0; order < NR_PAGE_ORDERS; ++order)
+                seq_printf(m, "%5d ", order);
+        seq_putc(m, '\n');
+
 	walk_zones_in_node(m, pgdat, true, false, unusable_show_print);
 
 	return 0;
@@ -2230,7 +2237,7 @@ static void extfrag_show_print(struct seq_file *m,
 	/* Alloc on stack as interrupts are disabled for zone walk */
 	struct contig_page_info info;
 
-	seq_printf(m, "Node %d, zone %8s ",
+	seq_printf(m, "Node %d, zone %10s ",
 				pgdat->node_id,
 				zone->name);
 	for (order = 0; order < NR_PAGE_ORDERS; ++order) {
@@ -2247,8 +2254,15 @@ static void extfrag_show_print(struct seq_file *m,
  */
 static int extfrag_show(struct seq_file *m, void *arg)
 {
+	int order;
 	pg_data_t *pgdat = (pg_data_t *)arg;
 
+	/* Print header */
+	seq_printf(m, "%s ", "Extfrag index at order:");
+	for (order = 0; order < NR_PAGE_ORDERS; ++order)
+		seq_printf(m, "%6d ", order);
+	seq_putc(m, '\n');
+
 	walk_zones_in_node(m, pgdat, true, false, extfrag_show_print);
 
 	return 0;
-- 
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-28 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 11:48 [PATCH] mm/vmstat: Add order's information for extfrag_index and unusable_index Hao Ge
  -- strict thread matches above, loose matches on Subject: below --
2024-02-28 11:33 Hao Ge
2024-02-28 11:43 ` Hao Ge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox