linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages
@ 2016-06-07 20:26 Mike Kravetz
  2016-06-07 21:14 ` Jayaramappa, Srilakshmi
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Kravetz @ 2016-06-07 20:26 UTC (permalink / raw)
  To: linux-kernel, linux-kselftest
  Cc: Shuah Khan, Sri Jayaramappa, Eric B Munson, Andrew Morton, Mike Kravetz

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 <mike.kravetz@oracle.com>
---
 tools/testing/selftests/vm/compaction_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vm/compaction_test.c b/tools/testing/selftests/vm/compaction_test.c
index 932ff57..00c4f65 100644
--- a/tools/testing/selftests/vm/compaction_test.c
+++ b/tools/testing/selftests/vm/compaction_test.c
@@ -136,7 +136,7 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
 	printf("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;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages
  2016-06-07 20:26 [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages Mike Kravetz
@ 2016-06-07 21:14 ` Jayaramappa, Srilakshmi
  0 siblings, 0 replies; 2+ messages in thread
From: Jayaramappa, Srilakshmi @ 2016-06-07 21:14 UTC (permalink / raw)
  To: Mike Kravetz, linux-kernel, linux-kselftest
  Cc: Shuah Khan, Eric B Munson, Andrew Morton



On 6/7/16, 4:26 PM, "Mike Kravetz" <mike.kravetz@oracle.com> wrote:

>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 <mike.kravetz@oracle.com>
>---
> tools/testing/selftests/vm/compaction_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/tools/testing/selftests/vm/compaction_test.c b/tools/testing/selftests/vm/compaction_test.c
>index 932ff57..00c4f65 100644
>--- a/tools/testing/selftests/vm/compaction_test.c
>+++ b/tools/testing/selftests/vm/compaction_test.c
>@@ -136,7 +136,7 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
> 	printf("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;
>-- 
>2.4.11
>


Looks good, thanks!

-Sri Jayaramappa

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-07 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07 20:26 [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages Mike Kravetz
2016-06-07 21:14 ` Jayaramappa, Srilakshmi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).