[LTP] [PATCH 2/3] lib/mem: introduce a new function set_global_mempolicy()

Zhouping Liu
2013-04-08T06:40:47Z

Fork out a new function set_global_mempolicy() from the
previous testoom() func, which will be useful for other func.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
testcases/kernel/mem/lib/mem.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 491afe8..39fa99a 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -91,7 +91,7 @@ void oom(int testcase, int lite)
}
}

-void testoom(int mempolicy, int lite)
+static void set_global_mempolicy(int mempolicy)
{
#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
&& HAVE_MPOL_CONSTANTS
@@ -133,6 +133,11 @@ void testoom(int mempolicy, int lite)
tst_brkm(TBROK|TERRNO, cleanup, "set_mempolicy");
}
#endif
+}
+
+void testoom(int mempolicy, int lite)
+{
+ set_global_mempolicy(mempolicy);

tst_resm(TINFO, "start normal OOM testing.");
oom(NORMAL, lite);
--
1.7.11.7