From: Dev Jain <dev.jain@arm.com>
To: akpm@linux-foundation.org, shuah@kernel.org
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com,
sjayaram@akamai.com, Dev Jain <dev.jain@arm.com>,
stable@vger.kernel.org
Subject: [PATCH 1/2] selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepages
Date: Wed, 15 May 2024 15:06:32 +0530 [thread overview]
Message-ID: <20240515093633.54814-2-dev.jain@arm.com> (raw)
In-Reply-To: <20240515093633.54814-1-dev.jain@arm.com>
nr_hugepages is not set to zero because the file offset has not been reset
after read(). Fix that using lseek().
Fixes: bd67d5c15cc1 ("Test compaction of mlocked memory")
Cc: stable@vger.kernel.org
Signed-off-by: Dev Jain <dev.jain@arm.com>
---
Merge dependency: https://lore.kernel.org/all/20240513082842.4117782-1-dev.jain@arm.com/
Andrew, does it sound reasonable to have the fixes tag in the above
patch too, along with this series?
tools/testing/selftests/mm/compaction_test.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
index 533999b6c284..c5be395f8363 100644
--- a/tools/testing/selftests/mm/compaction_test.c
+++ b/tools/testing/selftests/mm/compaction_test.c
@@ -107,6 +107,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
goto close_fd;
}
+ lseek(fd, 0, SEEK_SET);
+
/* Start with the initial condition of 0 huge pages*/
if (write(fd, "0", sizeof(char)) != sizeof(char)) {
ksft_print_msg("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n",
--
2.30.2
next prev parent reply other threads:[~2024-05-15 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 9:36 [PATCH 0/2] Fixes for compaction_test Dev Jain
2024-05-15 9:36 ` Dev Jain [this message]
2024-05-20 0:00 ` [PATCH 1/2] selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepages Andrew Morton
2024-05-20 5:28 ` Dev Jain
2024-05-15 9:36 ` [PATCH 2/2] selftests/mm: compaction_test: Fix trivial test success and reduce probability of OOM-killer invocation Dev Jain
2024-05-20 0:03 ` Andrew Morton
2024-05-20 5:33 ` Dev Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240515093633.54814-2-dev.jain@arm.com \
--to=dev.jain@arm.com \
--cc=Anshuman.Khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shuah@kernel.org \
--cc=sjayaram@akamai.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).