kselftest: fix OOM in memory compaction test
authorArnd Bergmann <arnd@arndb.de>
Tue, 9 Jan 2018 16:26:24 +0000 (17:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:42:15 +0000 (15:42 +0100)
commit7dd2dbdd4606fc44da2cbb59fcd1c560c3f3fb94
tree6be8e9ed570335b2ff8e8d6b73b32f0fc9b18e97
parent9c2e7a048d19dce8b82e0dc169feb1721d856d37
kselftest: fix OOM in memory compaction test

commit 4c1baad223906943b595a887305f2e8124821dad upstream.

Running the compaction_test sometimes results in out-of-memory
failures. When I debugged this, it turned out that the code to
reset the number of hugepages to the initial value is simply
broken since we write into an open sysctl file descriptor
multiple times without seeking back to the start.

Adding the lseek here fixes the problem.

Cc: stable@vger.kernel.org
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Link: https://bugs.linaro.org/show_bug.cgi?id=3145
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/vm/compaction_test.c