selftests/vm/compaction_test: fix write to restore nr_hugepages
PATCH 3/41 selftests/vm/compaction_test: fix write to restore nr_hugepages
From: Mike Kravetz <[email protected]>
Subject: selftests/vm/compaction_test: fix write to restore nr_hugepages
The write at the end of the test to restore nr_hugepages to its previous value is failing. This is because it is trying to write the number of bytes in the char array as opposed to the number of bytes in the string.
Signed-off-by Mike Kravetz <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Sri Jayaramappa <[email protected]>
Cc Eric B Munson <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
tools/testing/selftests/vm/compaction_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/compaction_test.c renamed from tools/testing/selftests/vm/compaction_test.c~selftests-vm-compaction_test-fix-write-to-restore-nr_hugepages +1 -1
@@ -136,7 +136,7 @@ int check_compaction(unsigned long mem_fprintf ("No of huge pages allocated = %d\n" , (atoi (nr_hugepages))); -if (write (fd, initial_nr_hugepages,sizeof (initial_nr_hugepages)) +if (write (fd, initial_nr_hugepages,strlen (initial_nr_hugepages)) !=strlen (initial_nr_hugepages)) {perror ("Failed to write to /proc/sys/vm/nr_hugepages\n" ); goto close_fd;
_