Skip to contentSkip to conversation

syscalls/madvise06: Change drop_caches file checking mode

PATCH New Zou Wei 2 participants 2 messages Jan 14, 2020 – Jan 15, 2020

lore
Share & tools
lore

Zou Wei

author
#0 lore raw

PATCH 1/1 syscalls/madvise06: Change drop_caches file checking mode

The madvise06 case will be failed if merge the linux kernel lts patch on the below:

https://lore.kernel.org/linux-mm/[email protected]/
Currently, the drop_caches proc file and sysctl read back the last value written, suggesting this is somehow a stateful setting instead of a one-time command. Make it write-only, like e.g. compact_memory.

The commit id of the lts patch is: 204cb79ad42f015312a5bbd7012d09c93d9b46fb

---
 testcases/kernel/syscalls/madvise/madvise06.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/madvise/madvise06.c +1 -1
index 37840d0..329f558 100644
@@ -49,7 +49,7 @@ static void setup(void)
 
 	pg_sz = getpagesize();
 
-	check_path(drop_caches_fname);
+	access(drop_caches_fname, W_OK);
 	tst_res(TINFO, "dropping caches");
 	sync();
 	SAFE_FILE_PRINTF(drop_caches_fname, "3");

--
2.6.2

#1 lore raw

PATCH 1/1 syscalls/madvise06: Change drop_caches file checking mode

Hi!

Quoted 9 lines
---
 testcases/kernel/syscalls/madvise/madvise06.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/madvise/madvise06.c +0 -0
index 37840d0..329f558 100644

testcases/kernel/syscalls/madvise/madvise06.c static void setup(void) · line 52

Quoted 5 lines
testcases/kernel/syscalls/madvise/madvise06.c +1 -1
@@ -49,7 +49,7 @@ static void setup(void)
 
 	pg_sz = getpagesize();
 
-	check_path(drop_caches_fname);
+	access(drop_caches_fname, W_OK);

If you are not checking the return value it's no-op. Also the file has been added to Linux kernel 14 years ago, so it's safe to assume it's present. Hence I've modified to patch to simply remove the check.

Thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]