diff options
author | Eric Dumazet | 2019-11-14 08:43:27 -0800 |
---|---|---|
committer | David S. Miller | 2019-11-15 12:46:08 -0800 |
commit | 20021578ba226bda1f0ddf50e4d4a12ea1c6c6c1 (patch) | |
tree | 8397080c251b6cfb8efe38343a4d48f3ba88f7d5 /tools/testing | |
parent | 61ca533c0e94104c35fcb7858a23ec9a05d78143 (diff) |
selftests: net: tcp_mmap should create detached threads
Since we do not plan using pthread_join() in the server do_accept()
loop, we better create detached threads, or risk increasing memory
footprint over time.
Fixes: 192dc405f308 ("selftests: net: add tcp_mmap program")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/net/tcp_mmap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c index 31ced79f4f25..0e73a30f0c22 100644 --- a/tools/testing/selftests/net/tcp_mmap.c +++ b/tools/testing/selftests/net/tcp_mmap.c @@ -270,6 +270,11 @@ static void setup_sockaddr(int domain, const char *str_addr, static void do_accept(int fdlisten) { + pthread_attr_t attr; + + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (setsockopt(fdlisten, SOL_SOCKET, SO_RCVLOWAT, &chunk_size, sizeof(chunk_size)) == -1) { perror("setsockopt SO_RCVLOWAT"); @@ -288,7 +293,7 @@ static void do_accept(int fdlisten) perror("accept"); continue; } - res = pthread_create(&th, NULL, child_thread, + res = pthread_create(&th, &attr, child_thread, (void *)(unsigned long)fd); if (res) { errno = res; |