|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4] tools/xenconsoled: Increase file descriptor limit
Andrew Cooper writes ("[PATCH v4] tools/xenconsoled: Increase file descriptor
limit"):
> XenServer's VM density testing uncovered a regression when moving from
> sysvinit to systemd where the file descriptor limit dropped from 4096 to
> 1024. (XenServer had previously inserted a ulimit statement into its
> initscripts.)
>
> One solution is to use LimitNOFILE=4096 in xenconsoled.service to match the
> lost ulimit, but that is only a stopgap solution.
>
> As Xenconsoled genuinely needs a large number of file descriptors if a large
> number of domains are running, attempt to increase the limit.
...
There's still a lot of code here I think we can do without.
Why do we care about the system maximum ?
> + /*
> + * Will min_fds fit within our current hard limit?
> + * (likely on *BSD, unlikely on Linux)
> + * If so, raise our soft limit.
> + */
> + if (min_fds <= lim.rlim_max) {
> + struct rlimit new = {
> + .rlim_cur = min_fds,
> + .rlim_max = lim.rlim_max,
> + };
> +
> + if (setrlimit(RLIMIT_NOFILE, &new) < 0)
> + syslog(LOG_WARNING,
> + "Unable to increase fd soft limit: %lu -> %u, "
> + "hard %lu (%s) - May run out with lots of
> domains",
> + lim.rlim_cur, min_fds, lim.rlim_max,
> + strerror(errno));
> + } else {
> + /*
> + * Lets hope that, as a root process, we have sufficient
> + * privilege to up the hard limit.
> + */
> + struct rlimit new = { .rlim_cur = min_fds, .rlim_max = min_fds
> };
> +
> + if (setrlimit(RLIMIT_NOFILE, &new) < 0)
> + syslog(LOG_WARNING,
> + "Unable to increase fd hard limit: %lu -> %u
> (%s)"
> + " - May run out with lots of domains",
> + lim.rlim_max, min_fds, strerror(errno));
> + }
This is very repetitive. The only difference between the two branches
is (a) the value of .rlim_max and (b) the log message. (b) can be
dealt with by making the log message depend only on the contents of
new.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |