linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo
@ 2021-10-16 11:54 Hyeonggon Yoo
  2021-10-16 11:57 ` Not [PATCH] :) Hyeonggon Yoo
  2021-10-17  4:36 ` [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo Hyeonggon Yoo
  0 siblings, 2 replies; 3+ messages in thread
From: Hyeonggon Yoo @ 2021-10-16 11:54 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Hyeonggon Yoo, Johannes Weiner, Roman Gushchin,
	Shakeel Butt, Muchun Song, Andrew Morton

Hello, it seems there's mismatch in unit (byte and kB) in meminfo.
Would something like this will be acceptable?

commit d42f3245c7e2 ("mm: memcg: convert vmstat slab counters
to bytes") changed it to bytes but proc seems to print everything in
kilobytes.

---
 fs/proc/meminfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 6fa761c9cc78..182376582076 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -52,8 +52,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 		pages[lru] = global_node_page_state(NR_LRU_BASE + lru);
 
 	available = si_mem_available();
-	sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B);
-	sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B);
+	sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B) / 1024;
+	sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B) / 1024;
 
 	show_val_kb(m, "MemTotal:       ", i.totalram);
 	show_val_kb(m, "MemFree:        ", i.freeram);
-- 
2.27.0


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

* Not [PATCH] :)
  2021-10-16 11:54 [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo Hyeonggon Yoo
@ 2021-10-16 11:57 ` Hyeonggon Yoo
  2021-10-17  4:36 ` [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo Hyeonggon Yoo
  1 sibling, 0 replies; 3+ messages in thread
From: Hyeonggon Yoo @ 2021-10-16 11:57 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Johannes Weiner, Roman Gushchin, Shakeel Butt,
	Muchun Song, Andrew Morton

On Sat, Oct 16, 2021 at 11:54:29AM +0000, Hyeonggon Yoo wrote:
> Hello, it seems there's mismatch in unit (byte and kB) in meminfo.
> Would something like this will be acceptable?
> 
> commit d42f3245c7e2 ("mm: memcg: convert vmstat slab counters
> to bytes") changed it to bytes but proc seems to print everything in
> kilobytes.
> 

This is not actually patch - I'll send you a patch
if this is not my misunderstanding :)

Thanks,
Hyeonggon.

> ---
>  fs/proc/meminfo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
> index 6fa761c9cc78..182376582076 100644
> --- a/fs/proc/meminfo.c
> +++ b/fs/proc/meminfo.c
> @@ -52,8 +52,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
>  		pages[lru] = global_node_page_state(NR_LRU_BASE + lru);
>  
>  	available = si_mem_available();
> -	sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B);
> -	sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B);
> +	sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B) / 1024;
> +	sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B) / 1024;
>  
>  	show_val_kb(m, "MemTotal:       ", i.totalram);
>  	show_val_kb(m, "MemFree:        ", i.freeram);
> -- 
> 2.27.0
> 

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

* Re: [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo
  2021-10-16 11:54 [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo Hyeonggon Yoo
  2021-10-16 11:57 ` Not [PATCH] :) Hyeonggon Yoo
@ 2021-10-17  4:36 ` Hyeonggon Yoo
  1 sibling, 0 replies; 3+ messages in thread
From: Hyeonggon Yoo @ 2021-10-17  4:36 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Johannes Weiner, Roman Gushchin, Shakeel Butt,
	Muchun Song, Andrew Morton

On Sat, Oct 16, 2021 at 11:54:29AM +0000, Hyeonggon Yoo wrote:
> Hello, it seems there's mismatch in unit (byte and kB) in meminfo.
> Would something like this will be acceptable?
> 
> commit d42f3245c7e2 ("mm: memcg: convert vmstat slab counters
> to bytes") changed it to bytes but proc seems to print everything in
> kilobytes.
> 

Ignore this.

this was my misunderstanding of code :(
It internally converts to kilobytes when updating its data.

> ---
>  fs/proc/meminfo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
> index 6fa761c9cc78..182376582076 100644
> --- a/fs/proc/meminfo.c
> +++ b/fs/proc/meminfo.c
> @@ -52,8 +52,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
>  		pages[lru] = global_node_page_state(NR_LRU_BASE + lru);
>  
>  	available = si_mem_available();
> -	sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B);
> -	sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B);
> +	sreclaimable = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B) / 1024;
> +	sunreclaim = global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B) / 1024;
>  
>  	show_val_kb(m, "MemTotal:       ", i.totalram);
>  	show_val_kb(m, "MemFree:        ", i.freeram);
> -- 
> 2.27.0
> 

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

end of thread, other threads:[~2021-10-17  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 11:54 [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo Hyeonggon Yoo
2021-10-16 11:57 ` Not [PATCH] :) Hyeonggon Yoo
2021-10-17  4:36 ` [PATCH] Unit mismatch (Slab/SReclaimable/SUnreclaim) in meminfo Hyeonggon Yoo

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).