Commit 59c0d319 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <edumazet@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72653ae5
...@@ -157,6 +157,7 @@ void *child_thread(void *arg) ...@@ -157,6 +157,7 @@ void *child_thread(void *arg)
void *addr = NULL; void *addr = NULL;
double throughput; double throughput;
struct rusage ru; struct rusage ru;
size_t buffer_sz;
int lu, fd; int lu, fd;
fd = (int)(unsigned long)arg; fd = (int)(unsigned long)arg;
...@@ -164,9 +165,9 @@ void *child_thread(void *arg) ...@@ -164,9 +165,9 @@ void *child_thread(void *arg)
gettimeofday(&t0, NULL); gettimeofday(&t0, NULL);
fcntl(fd, F_SETFL, O_NDELAY); fcntl(fd, F_SETFL, O_NDELAY);
buffer = malloc(chunk_size); buffer = mmap_large_buffer(chunk_size, &buffer_sz);
if (!buffer) { if (buffer == (void *)-1) {
perror("malloc"); perror("mmap");
goto error; goto error;
} }
if (zflg) { if (zflg) {
...@@ -256,7 +257,7 @@ void *child_thread(void *arg) ...@@ -256,7 +257,7 @@ void *child_thread(void *arg)
ru.ru_nvcsw); ru.ru_nvcsw);
} }
error: error:
free(buffer); munmap(buffer, buffer_sz);
close(fd); close(fd);
if (zflg) if (zflg)
munmap(raddr, chunk_size + map_align); munmap(raddr, chunk_size + map_align);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment