selftests: net: tcp_mmap should create detached threads
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- tools/testing/selftests/net/tcp_mmap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/selftests/net/tcp_mmap.c +6 -1
@@ -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;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
From: Eric Dumazet <[email protected]>
Date: Thu, 14 Nov 2019 08:43:27 -0800
Quoted 6 lines
Since we do not plan using
pthread_join()in the serverdo_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 <[email protected]>
Applied.