mirror of
https://passt.top/passt
synced 2025-06-16 20:35:33 +02:00
tcp_splice: Close sockets right away on high number of open files
We can't take for granted that the hard limit for open files is big enough as to allow to delay closing sockets to a timer. Store the value of RTLIMIT_NOFILE we set at start, and use it to understand if we're approaching the limit with pending, spliced TCP connections. If that's the case, close sockets right away as soon as they're not needed, instead of deferring this task to a timer. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
be5bbb9b06
commit
92074c16a8
5 changed files with 27 additions and 7 deletions
2
passt.c
2
passt.c
|
@ -371,7 +371,7 @@ int main(int argc, char **argv)
|
|||
perror("getrlimit");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
limit.rlim_cur = limit.rlim_max;
|
||||
c.nofile = limit.rlim_cur = limit.rlim_max;
|
||||
if (setrlimit(RLIMIT_NOFILE, &limit)) {
|
||||
perror("setrlimit");
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue