* [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also
@ 2022-01-24 17:36 Richard Palethorpe via ltp
2022-01-24 17:36 ` [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Richard Palethorpe via ltp @ 2022-01-24 17:36 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
VFAT also allocates some extra non-pagecache memory for tracking
buffers.
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
include/tst_fs.h | 1 +
testcases/kernel/controllers/memcg/memcontrol02.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/include/tst_fs.h b/include/tst_fs.h
index efcdff608..3bab9da8b 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -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 0x2011BAB0UL
enum {
diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c
index 0b8f317a8..411f5aea6 100644
--- a/testcases/kernel/controllers/memcg/memcontrol02.c
+++ b/testcases/kernel/controllers/memcg/memcontrol02.c
@@ -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;
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread* [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison 2022-01-24 17:36 [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Richard Palethorpe via ltp @ 2022-01-24 17:36 ` Richard Palethorpe via ltp 2022-01-25 11:53 ` Cyril Hrubis 2022-01-24 17:36 ` [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp ` (2 subsequent siblings) 3 siblings, 1 reply; 12+ messages in thread From: Richard Palethorpe via ltp @ 2022-01-24 17:36 UTC (permalink / raw) To: ltp; +Cc: Richard Palethorpe 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); 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 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison 2022-01-24 17:36 ` [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp @ 2022-01-25 11:53 ` Cyril Hrubis 2022-01-25 11:54 ` Cyril Hrubis 0 siblings, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2022-01-25 11:53 UTC (permalink / raw) To: Richard Palethorpe; +Cc: ltp 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 chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison 2022-01-25 11:53 ` Cyril Hrubis @ 2022-01-25 11:54 ` Cyril Hrubis 2022-01-25 14:19 ` Richard Palethorpe 0 siblings, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2022-01-25 11:54 UTC (permalink / raw) To: Richard Palethorpe; +Cc: ltp 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? -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison 2022-01-25 11:54 ` Cyril Hrubis @ 2022-01-25 14:19 ` Richard Palethorpe 0 siblings, 0 replies; 12+ messages in thread From: Richard Palethorpe @ 2022-01-25 14:19 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp 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! -- Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize 2022-01-24 17:36 [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Richard Palethorpe via ltp 2022-01-24 17:36 ` [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp @ 2022-01-24 17:36 ` Richard Palethorpe via ltp 2022-01-25 14:58 ` Cyril Hrubis 2022-01-25 11:46 ` [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Cyril Hrubis 2022-01-25 14:49 ` [LTP] [PATCH v2 " Richard Palethorpe via ltp 3 siblings, 1 reply; 12+ messages in thread From: Richard Palethorpe via ltp @ 2022-01-24 17:36 UTC (permalink / raw) To: ltp; +Cc: Richard Palethorpe A 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. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> --- testcases/kernel/controllers/memcg/memcontrol02.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c index 0d144cf2d..fbf5f0469 100644 --- a/testcases/kernel/controllers/memcg/memcontrol02.c +++ b/testcases/kernel/controllers/memcg/memcontrol02.c @@ -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) -- 2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize 2022-01-24 17:36 ` [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp @ 2022-01-25 14:58 ` Cyril Hrubis 0 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2022-01-25 14:58 UTC (permalink / raw) To: Richard Palethorpe; +Cc: ltp Hi! Looks reasonable. Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also 2022-01-24 17:36 [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Richard Palethorpe via ltp 2022-01-24 17:36 ` [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp 2022-01-24 17:36 ` [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp @ 2022-01-25 11:46 ` Cyril Hrubis 2022-01-25 14:49 ` [LTP] [PATCH v2 " Richard Palethorpe via ltp 3 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2022-01-25 11:46 UTC (permalink / raw) To: Richard Palethorpe; +Cc: ltp Hi! Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also 2022-01-24 17:36 [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Richard Palethorpe via ltp ` (2 preceding siblings ...) 2022-01-25 11:46 ` [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Cyril Hrubis @ 2022-01-25 14:49 ` Richard Palethorpe via ltp 2022-01-25 14:49 ` [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp 2022-01-25 14:49 ` [LTP] [PATCH v2 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp 3 siblings, 2 replies; 12+ messages in thread From: Richard Palethorpe via ltp @ 2022-01-25 14:49 UTC (permalink / raw) To: ltp; +Cc: Richard Palethorpe VFAT also allocates some extra non-pagecache memory for tracking buffers. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> --- include/tst_fs.h | 1 + testcases/kernel/controllers/memcg/memcontrol02.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/tst_fs.h b/include/tst_fs.h index efcdff608..3bab9da8b 100644 --- a/include/tst_fs.h +++ b/include/tst_fs.h @@ -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 0x2011BAB0UL enum { diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c index 0b8f317a8..411f5aea6 100644 --- a/testcases/kernel/controllers/memcg/memcontrol02.c +++ b/testcases/kernel/controllers/memcg/memcontrol02.c @@ -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; -- 2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison 2022-01-25 14:49 ` [LTP] [PATCH v2 " Richard Palethorpe via ltp @ 2022-01-25 14:49 ` Richard Palethorpe via ltp 2022-01-25 15:31 ` Cyril Hrubis 2022-01-25 14:49 ` [LTP] [PATCH v2 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp 1 sibling, 1 reply; 12+ messages in thread From: Richard Palethorpe via ltp @ 2022-01-25 14:49 UTC (permalink / raw) To: ltp; +Cc: Richard Palethorpe 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c index 411f5aea6..75ae5f56c 100644 --- a/testcases/kernel/controllers/memcg/memcontrol02.c +++ b/testcases/kernel/controllers/memcg/memcontrol02.c @@ -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); -- 2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison 2022-01-25 14:49 ` [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp @ 2022-01-25 15:31 ` Cyril Hrubis 0 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2022-01-25 15:31 UTC (permalink / raw) To: Richard Palethorpe; +Cc: ltp Hi! Now it makes sense :-) Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 3/3] memcontrol02: Increase expected error with increase in pagesize 2022-01-25 14:49 ` [LTP] [PATCH v2 " Richard Palethorpe via ltp 2022-01-25 14:49 ` [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp @ 2022-01-25 14:49 ` Richard Palethorpe via ltp 1 sibling, 0 replies; 12+ messages in thread From: Richard Palethorpe via ltp @ 2022-01-25 14:49 UTC (permalink / raw) To: ltp; +Cc: Richard Palethorpe A 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. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> --- testcases/kernel/controllers/memcg/memcontrol02.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/controllers/memcg/memcontrol02.c b/testcases/kernel/controllers/memcg/memcontrol02.c index 75ae5f56c..9fa4ff811 100644 --- a/testcases/kernel/controllers/memcg/memcontrol02.c +++ b/testcases/kernel/controllers/memcg/memcontrol02.c @@ -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) -- 2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-01-25 15:29 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-24 17:36 [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Richard Palethorpe via ltp 2022-01-24 17:36 ` [LTP] [PATCH 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp 2022-01-25 11:53 ` Cyril Hrubis 2022-01-25 11:54 ` Cyril Hrubis 2022-01-25 14:19 ` Richard Palethorpe 2022-01-24 17:36 ` [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp 2022-01-25 14:58 ` Cyril Hrubis 2022-01-25 11:46 ` [LTP] [PATCH 1/3] memcontrol02: Add VFAT/MSDOS magic and set error to 50% for it also Cyril Hrubis 2022-01-25 14:49 ` [LTP] [PATCH v2 " Richard Palethorpe via ltp 2022-01-25 14:49 ` [LTP] [PATCH v2 2/3] memcontrol02: Fix anon memory comparison Richard Palethorpe via ltp 2022-01-25 15:31 ` Cyril Hrubis 2022-01-25 14:49 ` [LTP] [PATCH v2 3/3] memcontrol02: Increase expected error with increase in pagesize Richard Palethorpe via ltp
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox