diff mbox series

[1/3] tools/xentop: Fix calculation of used memory.

Message ID 416169fe34ec346a5edde2c66c4b017871c2a891.1582143896.git.linux@eikelenboom.it (mailing list archive)
State New, archived
Headers show
Series tools/xentop: Fix calculation of used memory and some cleanups | expand

Commit Message

Sander Eikelenboom Feb. 19, 2020, 8:31 p.m. UTC
Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
---
 tools/xenstat/xentop/xentop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu Feb. 20, 2020, 12:48 a.m. UTC | #1
The code looks correct to me, but I would like to add the following
commit message to this change.

Used memory should be calculated by subtracting free memory from total
memory.


On Wed, Feb 19, 2020 at 09:31:30PM +0100, Sander Eikelenboom wrote:
> Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
> ---
>  tools/xenstat/xentop/xentop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
> index af11ebfbf7..13b612f26d 100644
> --- a/tools/xenstat/xentop/xentop.c
> +++ b/tools/xenstat/xentop/xentop.c
> @@ -969,7 +969,7 @@ void do_summary(void)
>  	      "%u crashed, %u dying, %u shutdown \n",
>  	      num_domains, run, block, pause, crash, dying, shutdown);
>  
> -	used = xenstat_node_tot_mem(cur_node);
> +	used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node);

Also, I will add spaces around "-".

Acked-by: Wei Liu <wl@xen.org>

>  	freeable_mb = 0;
>  
>  	/* Dump node memory and cpu information */
> -- 
> 2.20.1
>
Wei Liu Feb. 20, 2020, 12:54 a.m. UTC | #2
On Thu, Feb 20, 2020 at 12:48:16AM +0000, Wei Liu wrote:
> The code looks correct to me, but I would like to add the following
> commit message to this change.
> 
> Used memory should be calculated by subtracting free memory from total
> memory.

Fixes: c588c002cc1 ("tools: remove tmem code and commands")

> 
> 
> On Wed, Feb 19, 2020 at 09:31:30PM +0100, Sander Eikelenboom wrote:
> > Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
> > ---
> >  tools/xenstat/xentop/xentop.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
> > index af11ebfbf7..13b612f26d 100644
> > --- a/tools/xenstat/xentop/xentop.c
> > +++ b/tools/xenstat/xentop/xentop.c
> > @@ -969,7 +969,7 @@ void do_summary(void)
> >  	      "%u crashed, %u dying, %u shutdown \n",
> >  	      num_domains, run, block, pause, crash, dying, shutdown);
> >  
> > -	used = xenstat_node_tot_mem(cur_node);
> > +	used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node);
> 
> Also, I will add spaces around "-".
> 
> Acked-by: Wei Liu <wl@xen.org>
> 
> >  	freeable_mb = 0;
> >  
> >  	/* Dump node memory and cpu information */
> > -- 
> > 2.20.1
> >
diff mbox series

Patch

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index af11ebfbf7..13b612f26d 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -969,7 +969,7 @@  void do_summary(void)
 	      "%u crashed, %u dying, %u shutdown \n",
 	      num_domains, run, block, pause, crash, dying, shutdown);
 
-	used = xenstat_node_tot_mem(cur_node);
+	used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node);
 	freeable_mb = 0;
 
 	/* Dump node memory and cpu information */