Discussion:
Where the pid=1 limits come from when using systemd
(too old to reply)
Jeffrey Zhang
2018-10-09 01:37:55 UTC
Permalink
hey guys,

In the recently test, i found some interesting phenomenon.

in systemd service, if i configure LimitNOFILE=infinity, it is not a real
infinity. the finally NOFILE will be 65536 ( on centos7 ) and 1048576 ( on
archlinux), and the pid=1 process also have the same value.

So my question is,

1. where the pid=1 limits come from? because centos7 and archlinux are
different, so i guess this should be configurable or pre-compiled.
2. is the inifinity equals pid=1 limits in default?
--
Regards,
Jeffrey Zhang
Blog: http://xcodest.me
Jeffrey Zhang
2018-10-09 05:40:29 UTC
Permalink
Thanks Richard,

That explains why archlinux NOFILE is 1048576. archlinux is using systemd
239.2-1

But it still can not explain where the pid=1 process limits come from? is
there any way to change it?
https://github.com/systemd/systemd/issues/6559
Post by Jeffrey Zhang
hey guys,
In the recently test, i found some interesting phenomenon.
in systemd service, if i configure LimitNOFILE=infinity, it is not a real
infinity. the finally NOFILE will be 65536 ( on centos7 ) and 1048576 ( on
archlinux), and the pid=1 process also have the same value.
So my question is,
1. where the pid=1 limits come from? because centos7 and archlinux are
different, so i guess this should be configurable or pre-compiled.
2. is the inifinity equals pid=1 limits in default?
--
Regards,
Jeffrey Zhang
Blog: http://xcodest.me
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
Regards,
Jeffrey Zhang
Blog: http://xcodest.me
Lennart Poettering
2018-10-09 07:54:26 UTC
Permalink
Post by Jeffrey Zhang
Thanks Richard,
That explains why archlinux NOFILE is 1048576. archlinux is using systemd
239.2-1
But it still can not explain where the pid=1 process limits come from? is
there any way to change it?
systemd when run as PID 1 will bump its own RLIMIT_NOFILE to the
maximum possible, since it might potentially need a lot of fds on
various setups where tons of .socket units are allocated.

See #5795.

And no, this is currently not configurable during runtime.

Lennart
--
Lennart Poettering, Red Hat
Jeffrey Zhang
2018-10-10 00:50:30 UTC
Permalink
After some search, i guess the pid=1 limits come from the nr_open now and
the default nr_open
come from linux code[0].

So there should be no way to change the pid=1 limit unless you re-compile
your kernel with some code change.

[0] https://github.com/torvalds/linux/blob/master/fs/file.c#L22-L27
Post by Jeffrey Zhang
Thanks Richard,
That explains why archlinux NOFILE is 1048576. archlinux is using systemd
239.2-1
But it still can not explain where the pid=1 process limits come from? is
there any way to change it?
https://github.com/systemd/systemd/issues/6559
Post by Jeffrey Zhang
hey guys,
In the recently test, i found some interesting phenomenon.
in systemd service, if i configure LimitNOFILE=infinity, it is not a
real infinity. the finally NOFILE will be 65536 ( on centos7 ) and 1048576
( on archlinux), and the pid=1 process also have the same value.
So my question is,
1. where the pid=1 limits come from? because centos7 and archlinux are
different, so i guess this should be configurable or pre-compiled.
2. is the inifinity equals pid=1 limits in default?
--
Regards,
Jeffrey Zhang
Blog: http://xcodest.me
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
Regards,
Jeffrey Zhang
Blog: http://xcodest.me
--
Regards,
Jeffrey Zhang
Blog: http://xcodest.me
Continue reading on narkive:
Loading...