diff mbox series

[2/3] memcontrol02: Fix anon memory comparison

Message ID 20220124173651.652-2-rpalethorpe@suse.com
State Superseded
Headers show
Series [1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also | expand

Commit Message

Richard Palethorpe Jan. 24, 2022, 5:36 p.m. UTC
All memory is being compared with the size malloc'ed instead of just
anon.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
 testcases/kernel/controllers/memcg/memcontrol02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis Jan. 25, 2022, 11:53 a.m. UTC | #1
Hi!
> All memory is being compared with the size malloc'ed instead of just
> anon.
> 
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
>  testcases/kernel/controllers/memcg/memcontrol02.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c
> index 411f5aea6..0d144cf2d 100644
> --- a/testcases/kernel/controllers/memcg/memcontrol02.c
> +++ b/testcases/kernel/controllers/memcg/memcontrol02.c
> @@ -68,7 +68,7 @@ static void alloc_anon_50M_check(void)
>  
>  	TST_EXP_EXPR(anon > 0, "(memory.stat.anon=%zd) > 0", anon);
>  	TST_EXP_EXPR(values_close(size, current, 3),
> -		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, current);
> +		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, anon);

I do not get this, we compare size and current and then print anon?

Should we just change the memory.stat.annon to memory.current instead?

>  	TST_EXP_EXPR(values_close(anon, current, 3),
>  		     "(memory.current=%zd) ~= (memory.stat.anon=%zd)",
>  		     current, anon);
> -- 
> 2.34.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis Jan. 25, 2022, 11:54 a.m. UTC | #2
Hi!
> > All memory is being compared with the size malloc'ed instead of just
> > anon.
> > 
> > Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> > ---
> >  testcases/kernel/controllers/memcg/memcontrol02.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c
> > index 411f5aea6..0d144cf2d 100644
> > --- a/testcases/kernel/controllers/memcg/memcontrol02.c
> > +++ b/testcases/kernel/controllers/memcg/memcontrol02.c
> > @@ -68,7 +68,7 @@ static void alloc_anon_50M_check(void)
> >  
> >  	TST_EXP_EXPR(anon > 0, "(memory.stat.anon=%zd) > 0", anon);
> >  	TST_EXP_EXPR(values_close(size, current, 3),
> > -		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, current);
> > +		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, anon);
> 
> I do not get this, we compare size and current and then print anon?
> 
> Should we just change the memory.stat.annon to memory.current instead?

Or did you forget to change the current in the values_close() to annon
as well?
Richard Palethorpe Jan. 25, 2022, 2:19 p.m. UTC | #3
Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Hi!
>> > All memory is being compared with the size malloc'ed instead of just
>> > anon.
>> > 
>> > Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
>> > ---
>> >  testcases/kernel/controllers/memcg/memcontrol02.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> > 
>> > diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c
>> > index 411f5aea6..0d144cf2d 100644
>> > --- a/testcases/kernel/controllers/memcg/memcontrol02.c
>> > +++ b/testcases/kernel/controllers/memcg/memcontrol02.c
>> > @@ -68,7 +68,7 @@ static void alloc_anon_50M_check(void)
>> >  
>> >  	TST_EXP_EXPR(anon > 0, "(memory.stat.anon=%zd) > 0", anon);
>> >  	TST_EXP_EXPR(values_close(size, current, 3),
>> > -		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, current);
>> > +		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, anon);
>> 
>> I do not get this, we compare size and current and then print anon?
>> 
>> Should we just change the memory.stat.annon to memory.current instead?
>
> Or did you forget to change the current in the values_close() to annon
> as well?

Yeah, sorry!
diff mbox series

Patch

diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c
index 411f5aea6..0d144cf2d 100644
--- a/testcases/kernel/controllers/memcg/memcontrol02.c
+++ b/testcases/kernel/controllers/memcg/memcontrol02.c
@@ -68,7 +68,7 @@  static void alloc_anon_50M_check(void)
 
 	TST_EXP_EXPR(anon > 0, "(memory.stat.anon=%zd) > 0", anon);
 	TST_EXP_EXPR(values_close(size, current, 3),
-		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, current);
+		     "(size=%zd) ~= (memory.stat.anon=%zd)", size, anon);
 	TST_EXP_EXPR(values_close(anon, current, 3),
 		     "(memory.current=%zd) ~= (memory.stat.anon=%zd)",
 		     current, anon);