public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@arm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 01/12] Move check_hugepage() helper to mem/lib
Date: Mon,  4 Dec 2017 16:36:44 +0000	[thread overview]
Message-ID: <20171204163655.8838-2-punit.agrawal@arm.com> (raw)
In-Reply-To: <20171204163655.8838-1-punit.agrawal@arm.com>

Move the check_hugepage() helper to mem/lib to be more widely available
to testcases. Specifically, it will be used in a subsequent commit to
check for the presence of hugepage support when running the thp tests.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
---
 testcases/kernel/mem/hugetlb/lib/hugetlb.c | 7 -------
 testcases/kernel/mem/hugetlb/lib/hugetlb.h | 1 -
 testcases/kernel/mem/include/mem.h         | 2 ++
 testcases/kernel/mem/lib/mem.c             | 6 ++++++
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
index f6a909a21..1ea47ebb5 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -26,7 +26,6 @@
  *
  *	The library contains the following routines:
  *
- *	check_hugepage()
  *	getipckey()
  *	getuserid()
  *	rm_shm()
@@ -42,12 +41,6 @@
 
 static long orig_hugepages = -1;
 
-void check_hugepage(void)
-{
-	if (access(PATH_HUGEPAGES, F_OK))
-		tst_brk(TCONF, "Huge page is not supported.");
-}
-
 long save_nr_hugepages(void)
 {
 	check_hugepage();
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index 53da45d8c..2843f0a8e 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -46,7 +46,6 @@
  * from shmid_ds.ipc_perm.mode
  */
 #define MODE_MASK	0x01FF
-#define PATH_HUGEPAGES	"/sys/kernel/mm/hugepages/"
 
 key_t shmkey;			/* an IPC key generated by ftok() */
 
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 287f8b3f6..95d0bda72 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -56,8 +56,10 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages);
 
 /* HUGETLB */
 
+#define PATH_HUGEPAGES		"/sys/kernel/mm/hugepages/"
 #define PATH_SHMMAX		"/proc/sys/kernel/shmmax"
 
+void check_hugepage(void);
 void write_memcg(void);
 
 /* cpuset/memcg */
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index fc2f130f4..7f2099b9e 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -347,6 +347,12 @@ static void verify(char **memory, char value, int proc,
 	free(s);
 }
 
+void check_hugepage(void)
+{
+	if (access(PATH_HUGEPAGES, F_OK))
+		tst_brk(TCONF, "Huge page is not supported.");
+}
+
 void write_memcg(void)
 {
 	SAFE_FILE_PRINTF(MEMCG_LIMIT, "%ld", TESTMEM);
-- 
2.15.0


  reply	other threads:[~2017-12-04 16:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 16:36 [LTP] [PATCH v3 00/12] Collection of fixes Punit Agrawal
2017-12-04 16:36 ` Punit Agrawal [this message]
2017-12-05  8:52   ` [LTP] [PATCH v3 01/12] Move check_hugepage() helper to mem/lib Petr Vorel
2017-12-04 16:36 ` [LTP] [PATCH v3 02/12] thp: ensure hugetlbfs is available Punit Agrawal
2017-12-05  8:53   ` Petr Vorel
2017-12-04 16:36 ` [LTP] [PATCH v3 03/12] hugeshmctl01: Convert to LTP synchronisation primitives Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 04/12] hugeshmctl01: Fix warning about signed/unsigned comparison Punit Agrawal
2017-12-05  9:50   ` Petr Vorel
2017-12-04 16:36 ` [LTP] [PATCH v3 05/12] hugeshmctl02: Fix allocation size for odd number of hugepages Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 06/12] hugeshmget02: add missing SHM_HUGETLB flag on segment creation Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 07/12] sigwaitinfo01: fix race between sending and dequeueing RT signals Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 08/12] sigwaitinfo01: catch SEGV and report success for bad_address2 testcase Punit Agrawal
2017-12-08 10:28   ` Cyril Hrubis
2017-12-08 11:49     ` Punit Agrawal
2017-12-08 12:09       ` Cyril Hrubis
2017-12-04 16:36 ` [LTP] [PATCH v3 09/12] syscalls/mount03: Copy setuid_test to execute instead of 'TEST FILE' Punit Agrawal
2017-12-08 10:26   ` Cyril Hrubis
2017-12-08 10:39     ` Punit Agrawal
2017-12-08 10:43       ` Cyril Hrubis
2017-12-08 10:58         ` Punit Agrawal
2017-12-08 11:37           ` Cyril Hrubis
2017-12-08 11:50             ` Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 10/12] getdtablesize01: Handle ENFILE errno Punit Agrawal
2017-12-08 10:27   ` Cyril Hrubis
2017-12-08 10:41     ` Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 11/12] perf_event_open: Handle absence of PMU gracefully Punit Agrawal
2017-12-04 16:36 ` [LTP] [PATCH v3 12/12] hotplug/cpu_hotplug: Remove bashism disown from kill_pid() Punit Agrawal
2017-12-05  8:21   ` Petr Vorel
2017-12-05 10:20     ` Punit Agrawal

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=20171204163655.8838-2-punit.agrawal@arm.com \
    --to=punit.agrawal@arm.com \
    --cc=ltp@lists.linux.it \
    /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