[LTP] [PATCH] mem/oom: don't fail if pthread_create hits EAGAIN
Jan Stancek
jstancek@redhat.com
Wed Nov 25 12:44:31 CET 2015
In a rare situation on system with many CPUs, small RAM
and overcommit_memory == 2, threads that are already started
can create memory pressure, that causes pthread_create
to hit EAGAIN. Don't fail the test, keep going with threads
that are already spawned.
Signed-off-by: Jan Stancek <jstancek@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 215c0527d068..cee4e91fb89f 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -90,7 +90,12 @@ static void child_alloc(int testcase, int lite, int threads)
(void *)((long)testcase)));
if (TEST_RETURN) {
tst_resm(TINFO | TRERRNO, "pthread_create");
- goto out;
+ /*
+ * Keep going if thread other than first fails to
+ * spawn due to lack of resources.
+ */
+ if (i == 0 || TEST_RETURN != EAGAIN)
+ goto out;
}
}
--
1.8.3.1
More information about the Ltp
mailing list