All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Palethorpe via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: Richard Palethorpe <rpalethorpe@suse.com>
Subject: [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize
Date: Mon, 24 Jan 2022 17:36:51 +0000	[thread overview]
Message-ID: <20220124173651.652-3-rpalethorpe@suse.com> (raw)
In-Reply-To: <20220124173651.652-1-rpalethorpe@suse.com>

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

  parent reply	other threads:[~2022-01-24 17:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Richard Palethorpe via ltp [this message]
2022-01-25 14:58   ` [LTP] [PATCH 3/3] memcontrol02: Increase expected error with increase in pagesize 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220124173651.652-3-rpalethorpe@suse.com \
    --to=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.