mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-09-03 12:11:34 +00:00
blow up rlimit of process
NOFILE: 1000000:1000000 NPROC: 30604:30604 SIGPENGING: 30604:30604 Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
+22
@@ -6,6 +6,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <sched.h>
|
||||
@@ -1144,6 +1145,7 @@ static int hyper_loop(void)
|
||||
struct epoll_event *events;
|
||||
struct hyper_pod *pod = &global_pod;
|
||||
sigset_t mask, omask;
|
||||
struct rlimit limit;
|
||||
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGCHLD);
|
||||
@@ -1162,6 +1164,26 @@ static int hyper_loop(void)
|
||||
sigdelset(&omask, SIGCHLD);
|
||||
signal(SIGCHLD, hyper_init_sigchld);
|
||||
|
||||
// setup open file limit
|
||||
limit.rlim_cur = limit.rlim_max = 1000000;
|
||||
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
|
||||
perror("set rlimit for NOFILE failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// setup process num limit
|
||||
limit.rlim_cur = limit.rlim_max = 30604;
|
||||
if (setrlimit(RLIMIT_NPROC, &limit) < 0) {
|
||||
perror("set rlimit for NPROC failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// setup pending signal limit, same with NRPROC
|
||||
if (setrlimit(RLIMIT_SIGPENDING, &limit) < 0) {
|
||||
perror("set rlimit for SIGPENDING failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctl.efd = epoll_create1(EPOLL_CLOEXEC);
|
||||
if (ctl.efd < 0) {
|
||||
perror("epoll_create failed");
|
||||
|
||||
Reference in New Issue
Block a user