From: Jan S. <jst...@re...> - 2014-07-29 12:32:43
|
There's no need to write pattern across whole range, just make sure we touch every page. Signed-off-by: Jan Stancek <jst...@re...> --- testcases/kernel/mem/lib/mem.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c index 61b1ee6..b0c97ae 100644 --- a/testcases/kernel/mem/lib/mem.c +++ b/testcases/kernel/mem/lib/mem.c @@ -28,7 +28,8 @@ static int alloc_mem(long int length, int testcase) { - void *s; + char *s; + long i, pagesz = getpagesize(); tst_resm(TINFO, "allocating %ld bytes.", length); @@ -43,7 +44,8 @@ static int alloc_mem(long int length, int testcase) if (testcase == KSM && madvise(s, length, MADV_MERGEABLE) == -1) return errno; #endif - memset(s, '\a', length); + for (i = 0; i < length; i += pagesz) + s[i] = '\a'; return 0; } -- 1.7.1 |