From: Donet Tom <donettom@linux.ibm.com>
To: akpm@linux-foundation.org
Cc: Usama.Anjum@collabora.com, donettom@linux.ibm.com,
kernel@collabora.com, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
shuah@kernel.org
Subject: [PATCH] selftests: hugetlb_dio: Fixup Check for initial conditions to skip in the start
Date: Sun, 10 Nov 2024 00:49:03 -0600 [thread overview]
Message-ID: <20241110064903.23626-1-donettom@linux.ibm.com> (raw)
In-Reply-To: <20241109223436.3ddeaf1d60e1ade8f562d757@linux-foundation.org>
This test verifies that a hugepage, used as a user buffer for
DIO operations, is correctly freed upon unmapping. To test this,
we read the count of free hugepages before and after the mmap,
DIO, and munmap operations, then check if the free hugepage count
is the same.
Reading free hugepages before the test was removed by commit
0268d4579901 ('selftests: hugetlb_dio: check for initial conditions
to skip at the start'), causing the test to always fail.
This patch adds back reading the free hugepages before starting
the test. With this patch, the tests are now passing.
Test Results without this patch
./tools/testing/selftests/mm/hugetlb_dio
TAP version 13
1..4
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 1 : Huge pages not freed!
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 2 : Huge pages not freed!
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 3 : Huge pages not freed!
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 4 : Huge pages not freed!
# Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0
Test results with this patch.
./tools/testing/selftests/mm/hugetlb_dio
TAP version 13
1..4
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 1 : Huge pages not freed!
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 2 : Huge pages not freed!
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 3 : Huge pages not freed!
# No. Free pages before allocation : 0
# No. Free pages after munmap : 100
not ok 4 : Huge pages not freed!
# Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0
Fixes: 0268d4579901 ("selftests: hugetlb_dio: check for initial conditions to skip in the start")
Signed-off-by: Donet Tom <donettom@linux.ibm.com>
---
tools/testing/selftests/mm/hugetlb_dio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
index 60001c142ce9..432d5af15e66 100644
--- a/tools/testing/selftests/mm/hugetlb_dio.c
+++ b/tools/testing/selftests/mm/hugetlb_dio.c
@@ -44,6 +44,13 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
if (fd < 0)
ksft_exit_fail_perror("Error opening file\n");
+ /* Get the free huge pages before allocation */
+ free_hpage_b = get_free_hugepages();
+ if (free_hpage_b == 0) {
+ close(fd);
+ ksft_exit_skip("No free hugepage, exiting!\n");
+ }
+
/* Allocate a hugetlb page */
orig_buffer = mmap(NULL, h_pagesize, mmap_prot, mmap_flags, -1, 0);
if (orig_buffer == MAP_FAILED) {
--
2.43.5
next prev parent reply other threads:[~2024-12-05 15:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 14:15 [PATCH] selftests: hugetlb_dio: " Muhammad Usama Anjum
2024-11-01 18:54 ` Andrew Morton
2024-11-08 10:35 ` Donet Tom
2024-11-08 10:49 ` Donet Tom
2024-11-08 14:13 ` Muhammad Usama Anjum
2024-11-10 6:20 ` Andrew Morton
2024-11-10 6:34 ` Andrew Morton
2024-11-10 6:49 ` Donet Tom [this message]
2024-11-10 6:52 ` [PATCH] selftests: hugetlb_dio: Fixup " Donet Tom
2024-11-11 6:59 ` Andrew Morton
2024-11-10 6:56 ` Donet Tom
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=20241110064903.23626-1-donettom@linux.ibm.com \
--to=donettom@linux.ibm.com \
--cc=Usama.Anjum@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shuah@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox