summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/mm/hugetlb_dio.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2024-11-13 21:51:15 +0100
committerAlexei Starovoitov <ast@kernel.org>2024-11-13 21:52:51 +0100
commit871438170326dc28125cb823d19c1d5c5304474d (patch)
tree789e34628d77dc234f1b6e893c237969c6e14287 /tools/testing/selftests/mm/hugetlb_dio.c
parentsamples/bpf: Remove unused variable in xdp2skb_meta_kern.c (diff)
parentMerge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf (diff)
downloadlinux-871438170326dc28125cb823d19c1d5c5304474d.tar.xz
linux-871438170326dc28125cb823d19c1d5c5304474d.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Cross-merge bpf fixes after downstream PR. In particular to bring the fix in commit aa30eb3260b2 ("bpf: Force checkpoint when jmp history is too long"). The follow up verifier work depends on it. And the fix in commit 6801cf7890f2 ("selftests/bpf: Use -4095 as the bad address for bits iterator"). It's fixing instability of BPF CI on s390 arch. No conflicts. Adjacent changes in: Auto-merging arch/Kconfig Auto-merging kernel/bpf/helpers.c Auto-merging kernel/bpf/memalloc.c Auto-merging kernel/bpf/verifier.c Auto-merging mm/slab_common.c Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/mm/hugetlb_dio.c')
-rw-r--r--tools/testing/selftests/mm/hugetlb_dio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
index f9ac20c657ec..432d5af15e66 100644
--- a/tools/testing/selftests/mm/hugetlb_dio.c
+++ b/tools/testing/selftests/mm/hugetlb_dio.c
@@ -94,8 +94,20 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
int main(void)
{
size_t pagesize = 0;
+ int fd;
ksft_print_header();
+
+ /* Open the file to DIO */
+ fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT, 0664);
+ if (fd < 0)
+ ksft_exit_skip("Unable to allocate file: %s\n", strerror(errno));
+ close(fd);
+
+ /* Check if huge pages are free */
+ if (!get_free_hugepages())
+ ksft_exit_skip("No free hugepage, exiting\n");
+
ksft_set_plan(4);
/* Get base page size */