Skip to contentSkip to conversation

syscalls/madvise04: new test for madvise(MADV_DONTNEED)

PATCH zhaogongyi via ltp 1 participant 1 message Oct 12, 2022

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 58 lines

Hi!

Quoted 8 lines

Test cases for madvise(2) system call, verify that MADV_DONTNEED can be applied to Huge TLB pages after kernel version 5.18.

---
 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/madvise/.gitignore  |  1 +

testcases/kernel/syscalls/madvise/madvise04.c | 49

+++++++++++++++++++

Quoted 35 lines
 3 files changed, 51 insertions(+)
 create mode 100644 testcases/kernel/syscalls/madvise/madvise04.c
runtest/syscalls index renamed from runtest/syscalls +0 -0

c81764df4..eb1910cec 100644

runtest/syscalls +1 -0
@@ -941,6 +941,7 @@ mincore04 mincore04
 madvise01 madvise01
 madvise02 madvise02
 madvise03 madvise03
+madvise04 madvise04
 madvise05 madvise05
 madvise06 madvise06
 madvise07 madvise07
testcases/kernel/syscalls/madvise/.gitignore +1 -0
index f4bfdfefe..db8ce47c1 100644
@@ -1,6 +1,7 @@
 /madvise01
 /madvise02
 /madvise03
+/madvise04
 /madvise05
 /madvise06
 /madvise07
testcases/kernel/syscalls/madvise/madvise04.c new file +0 -0
new file mode 100644
index 000000000..ba15de092

testcases/kernel/syscalls/madvise/madvise04.c line 9

Quoted 9 lines
testcases/kernel/syscalls/madvise/madvise04.c new file +9 -0
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved.
+ * Author: Zhao Gongyi <[email protected]>  */
+
+/*\
+ * [Description]
+ *
+ * Test cases for madvise(2) system call, advise value as

"MADV_MADV_DONTNEED":

testcases/kernel/syscalls/madvise/madvise04.c line 10

Quoted 1 line
testcases/kernel/syscalls/madvise/madvise04.c new file +1 -0
+ *   MADV_DONTNEED can be applied to Huge TLB pages after kernel

version 5.18.

Quoted 17 lines

testcases/kernel/syscalls/madvise/madvise04.c line 22

Quoted 13 lines
testcases/kernel/syscalls/madvise/madvise04.c new file +12 -0
+ */
+
+#include "tst_test.h"
+
+#define MAP_SIZE (8 * 1024)
+
+static char *addr;
+static int mapsz;
+
+static void run(void)
+{
+	TST_EXP_PASS(madvise(addr, mapsz, MADV_DONTNEED));

Should we check that the pages have been zero filled like in the previous case?

It looks good to add the checking.

Regards,
Gongyi

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp