summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/mm/migration.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/mm/migration.c')
-rw-r--r--tools/testing/selftests/mm/migration.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/testing/selftests/mm/migration.c b/tools/testing/selftests/mm/migration.c
index 379581567f27..6908569ef406 100644
--- a/tools/testing/selftests/mm/migration.c
+++ b/tools/testing/selftests/mm/migration.c
@@ -10,12 +10,13 @@
#include <numa.h>
#include <numaif.h>
#include <sys/mman.h>
+#include <sys/prctl.h>
#include <sys/types.h>
#include <signal.h>
#include <time.h>
#define TWOMEG (2<<20)
-#define RUNTIME (60)
+#define RUNTIME (20)
#define ALIGN(x, a) (((x) + (a - 1)) & (~((a) - 1)))
@@ -155,10 +156,15 @@ TEST_F_TIMEOUT(migration, shared_anon, 2*RUNTIME)
memset(ptr, 0xde, TWOMEG);
for (i = 0; i < self->nthreads - 1; i++) {
pid = fork();
- if (!pid)
+ if (!pid) {
+ prctl(PR_SET_PDEATHSIG, SIGHUP);
+ /* Parent may have died before prctl so check now. */
+ if (getppid() == 1)
+ kill(getpid(), SIGHUP);
access_mem(ptr);
- else
+ } else {
self->pids[i] = pid;
+ }
}
ASSERT_EQ(migrate(ptr, self->n1, self->n2), 0);