memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also
PATCH 1/3 memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also
VFAT also allocates some extra non-pagecache memory for tracking buffers.
--- include/tst_fs.h | 1 + testcases/kernel/controllers/memcg/memcontrol02.c | 1 + 2 files changed, 2 insertions(+)
include/tst_fs.h +1 -0
@@ -30,6 +30,7 @@#define TST_EXOFS_MAGIC 0x5DF5#define TST_OVERLAYFS_MAGIC 0x794c7630#define TST_FUSE_MAGIC 0x65735546 +#define TST_VFAT_MAGIC 0x4d44/* AKA MSDOS */ #define TST_EXFAT_MAGIC 0x2011BAB0ULenum {
testcases/kernel/controllers/memcg/memcontrol02.c +1 -0
@@ -153,6 +153,7 @@ static void setup(void) cg_test =tst_cgroup_get_test_group ();switch (tst_fs_type (TMPDIR )) { +case TST_VFAT_MAGIC :case TST_EXFAT_MAGIC :case TST_EXT234_MAGIC : file_to_all_error =50 ;
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/3 memcontrol02: Fix anon memory comparison
All memory is being compared with the size malloc'ed instead of just anon.
--- testcases/kernel/controllers/memcg/memcontrol02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/memcg/memcontrol02.c +1 -1
@@ -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);
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison
Hi!
Quoted 13 lines
All memory is being compared with the size malloc'ed instead of just anon.
Signed-off-by Richard Palethorpe <[email protected]>--- testcases/kernel/controllers/memcg/memcontrol02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/controllers/memcg/memcontrol02.c +0
-0
testcases/kernel/controllers/memcg/memcontrol02.c static void alloc_anon_50M_check(void) · line 71
Quoted 5 lines
testcases/kernel/controllers/memcg/memcontrol02.c +1
-1@@ -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?
Quoted 9 lines
testcases/kernel/controllers/memcg/memcontrol02.c +0
-0TST_EXP_EXPR (values_close (anon, current,3 ),"(memory.current=%zd) ~= (memory.stat.anon=%zd)" , current, anon);Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison
Hi!
Quoted 14 lines
Quoted 14 lines
All memory is being compared with the size malloc'ed instead of just anon.
Signed-off-by Richard Palethorpe <[email protected]>--- testcases/kernel/controllers/memcg/memcontrol02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/controllers/memcg/memcontrol02.c +0
-0@@ -68,7 +68,7 @@ static void alloc_anon_50M_check(void)
Quoted 8 lines
testcases/kernel/controllers/memcg/memcontrol02.c static void alloc_anon_50M_check(void) · line 71
Quoted 4 lines
testcases/kernel/controllers/memcg/memcontrol02.c +1
-1TST_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?
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison
Hello,
Quoted 22 lines · Cyril Hrubis
Hi!
Quoted 21 lines
Quoted 13 lines
All memory is being compared with the size malloc'ed instead of just anon.
Signed-off-by Richard Palethorpe <[email protected]>--- testcases/kernel/controllers/memcg/memcontrol02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/controllers/memcg/memcontrol02.c +0
-0testcases/kernel/controllers/memcg/memcontrol02.c static void alloc_anon_50M_check(void) · line 71
Quoted 5 lines
testcases/kernel/controllers/memcg/memcontrol02.c +1
-1@@ -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?
Quoted 4 lines
Quoted 1 line
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!
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 3/3 memcontrol02: Increase expected error with increase in pagesize
In reply to Richard Palethorpe via ltpA few percent seems to be wasted with the increase in page size from 4k to 64k in these tests. For some reason, this appears to cause the test to fail on exfat on the anon test, but only exfat. We add 4% to the error for 64k pages.
--- testcases/kernel/controllers/memcg/memcontrol02.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
testcases/kernel/controllers/memcg/memcontrol02.c +6 -2
@@ -39,13 +39,17 @@ static int fd;static int file_to_all_error =10 ;/* -* Checks if two given values differ by less than err% of their sum. +* Checks if two given values differ by less than err% of their +* sum. An extra percent is added for every doubling of the page size +* to compensate for wastage in page sized allocations. */ static inline int values_close (const ssize_t a,const ssize_t b,const ssize_t err) { -return 100 *labs (a - b) <= (a + b) * err; +const ssize_t page_adjusted_err =ffs (page_size >>13 ) + err; + +return 100 *labs (a - b) <= (a + b) * page_adjusted_err; }static void alloc_anon_50M_check (void )
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize
Hi!
Looks reasonable.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/3 memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also
In reply to Richard Palethorpe via ltpVFAT also allocates some extra non-pagecache memory for tracking buffers.
--- include/tst_fs.h | 1 + testcases/kernel/controllers/memcg/memcontrol02.c | 1 + 2 files changed, 2 insertions(+)
include/tst_fs.h +1 -0
@@ -30,6 +30,7 @@#define TST_EXOFS_MAGIC 0x5DF5#define TST_OVERLAYFS_MAGIC 0x794c7630#define TST_FUSE_MAGIC 0x65735546 +#define TST_VFAT_MAGIC 0x4d44/* AKA MSDOS */ #define TST_EXFAT_MAGIC 0x2011BAB0ULenum {
testcases/kernel/controllers/memcg/memcontrol02.c +1 -0
@@ -153,6 +153,7 @@ static void setup(void) cg_test =tst_cgroup_get_test_group ();switch (tst_fs_type (TMPDIR )) { +case TST_VFAT_MAGIC :case TST_EXFAT_MAGIC :case TST_EXT234_MAGIC : file_to_all_error =50 ;
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/3 memcontrol02: Fix anon memory comparison
All memory is being compared with the size malloc'ed instead of just anon.
--- testcases/kernel/controllers/memcg/memcontrol02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/controllers/memcg/memcontrol02.c +2 -2
@@ -67,8 +67,8 @@ static void alloc_anon_50M_check(void)SAFE_CGROUP_LINES_SCANF (cg_child,"memory.stat" , anon_key_fmt, &anon);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); +TST_EXP_EXPR (values_close (size, anon,3 ), +"(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);
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison
Hi!
Now it makes sense :-)
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 3/3 memcontrol02: Increase expected error with increase in pagesize
In reply to Richard Palethorpe via ltpA few percent seems to be wasted with the increase in page size from 4k to 64k in these tests. For some reason, this appears to cause the test to fail on exfat on the anon test, but only exfat. We add 4% to the error for 64k pages.
--- testcases/kernel/controllers/memcg/memcontrol02.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
testcases/kernel/controllers/memcg/memcontrol02.c +6 -2
@@ -39,13 +39,17 @@ static int fd;static int file_to_all_error =10 ;/* -* Checks if two given values differ by less than err% of their sum. +* Checks if two given values differ by less than err% of their +* sum. An extra percent is added for every doubling of the page size +* to compensate for wastage in page sized allocations. */ static inline int values_close (const ssize_t a,const ssize_t b,const ssize_t err) { -return 100 *labs (a - b) <= (a + b) * err; +const ssize_t page_adjusted_err =ffs (page_size >>13 ) + err; + +return 100 *labs (a - b) <= (a + b) * page_adjusted_err; }static void alloc_anon_50M_check (void )
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp