Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1416594 > unrolled thread

[PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages

Started byMike Kravetz <mike.kravetz@oracle.com>
First post2016-06-07 22:30 +0200
Last post2016-06-07 23:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages Mike Kravetz <mike.kravetz@oracle.com> - 2016-06-07 22:30 +0200
    Re: [PATCH] selftests/vm/compaction_test: fix write to restore  nr_hugepages "Jayaramappa, Srilakshmi" <sjayaram@akamai.com> - 2016-06-07 23:20 +0200

#1416594 — [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages

FromMike Kravetz <mike.kravetz@oracle.com>
Date2016-06-07 22:30 +0200
Subject[PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages
Message-ID<rHvNo-7ix-41@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1416645 — Re: [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages

From"Jayaramappa, Srilakshmi" <sjayaram@akamai.com>
Date2016-06-07 23:20 +0200
SubjectRe: [PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages
Message-ID<rHwzL-7OY-7@gated-at.bofh.it>
In reply to#1416594

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web