diff options
author | Eric Dumazet <edumazet@google.com> | 2020-08-20 10:11:18 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-08-20 16:14:53 -0700 |
commit | 59c0d31988fb366189502a8ac66b7fe1486b7e40 (patch) | |
tree | 3f43cd2e8b31e71ea928e603bf87a27c0da90797 /tools | |
parent | 72653ae5303c626ca29fcbcbb8165a894a104adf (diff) | |
download | linux-59c0d31988fb366189502a8ac66b7fe1486b7e40.tar.gz linux-59c0d31988fb366189502a8ac66b7fe1486b7e40.tar.bz2 linux-59c0d31988fb366189502a8ac66b7fe1486b7e40.zip |
selftests: net: tcp_mmap: Use huge pages in receive path
One down side of using TCP rx zerocopy is one extra TLB miss
per page after the mapping operation.
While if the application is using hugepages, the non zerocopy
recvmsg() will not have to pay these TLB costs.
This patch allows server side to use huge pages for
the non zero copy case, to allow fair comparisons when
both solutions use optimal conditions.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/net/tcp_mmap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c index ca2618f3e7a1..00f837c9bc6c 100644 --- a/tools/testing/selftests/net/tcp_mmap.c +++ b/tools/testing/selftests/net/tcp_mmap.c @@ -157,6 +157,7 @@ void *child_thread(void *arg) void *addr = NULL; double throughput; struct rusage ru; + size_t buffer_sz; int lu, fd; fd = (int)(unsigned long)arg; @@ -164,9 +165,9 @@ void *child_thread(void *arg) gettimeofday(&t0, NULL); fcntl(fd, F_SETFL, O_NDELAY); - buffer = malloc(chunk_size); - if (!buffer) { - perror("malloc"); + buffer = mmap_large_buffer(chunk_size, &buffer_sz); + if (buffer == (void *)-1) { + perror("mmap"); goto error; } if (zflg) { @@ -256,7 +257,7 @@ end: ru.ru_nvcsw); } error: - free(buffer); + munmap(buffer, buffer_sz); close(fd); if (zflg) munmap(raddr, chunk_size + map_align); |