diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2019-08-20 01:45:18 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-08-22 22:48:26 +0100 |
commit | 0d5c966c30560086f91f2573849a3a01ef182d72 (patch) | |
tree | c2ec846ac6f915f9fa5643a7bfc5f51da8af4df0 /meta | |
parent | 66990a7ac756486086a9ba5851f862c85c0a4b3d (diff) | |
download | poky-0d5c966c30560086f91f2573849a3a01ef182d72.tar.gz |
nfs-utils: decrease RLIMIT_NOFILE to 4k for systemd
On systemd, it set RLIMIT_NOFILE to 512k, since do_testimage
for core-image-sato-sdk has memory limitation (256Mib) which
caused rpc.statd failed with out of memory.
[ 531.306146] Out of memory: Kill process 193 (rpc.statd) score 200 or sacrifice child
The rpc.statd and rpc.mountd allocates memory according to
RLIMIT_NOFILE, so decrease it to 4k to keep sync with sysvinit
After applying the patch, the memory cost is the same with sysvinit:
root@qemux86-64:~# systemctl status nfs-statd
* nfs-statd.service - NFS status monitor for NFSv2/3 locking.
Loaded: loaded (/lib/systemd/system/nfs-statd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-08-20 03:16:18 UTC; 3min 26s ago
Main PID: 343 (rpc.statd)
Tasks: 1 (limit: 271)
Memory: 1.0M
root@qemux86-64:~# systemctl status nfs-mountd
* nfs-mountd.service - NFS Mount Daemon
Loaded: loaded (/etc/systemd/system/nfs-mountd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-08-20 03:19:01 UTC; 1min 21s ago
Main PID: 451 (rpc.mountd)
Tasks: 1 (limit: 271)
Memory: 736.0K
Suggested-by: Chen Qi <qi.chen@windriver.com>
(From OE-Core rev: 6d61cd2bdc9e326eaa59082b5dd7423e522b96d3)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
3 files changed, 6 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service index 3c3a8022ce..c01415de84 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service | |||
@@ -11,6 +11,7 @@ ConditionPathExists=@SYSCONFDIR@/exports | |||
11 | [Service] | 11 | [Service] |
12 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf | 12 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf |
13 | ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS | 13 | ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS |
14 | LimitNOFILE=@HIGH_RLIMIT_NOFILE@ | ||
14 | 15 | ||
15 | [Install] | 16 | [Install] |
16 | WantedBy=multi-user.target | 17 | WantedBy=multi-user.target |
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service index 6e196b8c8c..4fa64e1998 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service | |||
@@ -8,6 +8,7 @@ After=network.target nss-lookup.target rpcbind.service | |||
8 | [Service] | 8 | [Service] |
9 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf | 9 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf |
10 | ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS | 10 | ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS |
11 | LimitNOFILE=@HIGH_RLIMIT_NOFILE@ | ||
11 | 12 | ||
12 | [Install] | 13 | [Install] |
13 | WantedBy=multi-user.target | 14 | WantedBy=multi-user.target |
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb index ac4437b925..28f98980d4 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb | |||
@@ -119,6 +119,9 @@ do_compile_prepend() { | |||
119 | make clean | 119 | make clean |
120 | } | 120 | } |
121 | 121 | ||
122 | # Works on systemd only | ||
123 | HIGH_RLIMIT_NOFILE ??= "4096" | ||
124 | |||
122 | do_install_append () { | 125 | do_install_append () { |
123 | install -d ${D}${sysconfdir}/init.d | 126 | install -d ${D}${sysconfdir}/init.d |
124 | install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver | 127 | install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver |
@@ -133,6 +136,7 @@ do_install_append () { | |||
133 | install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_unitdir}/system/ | 136 | install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_unitdir}/system/ |
134 | sed -i -e 's,@SBINDIR@,${sbindir},g' \ | 137 | sed -i -e 's,@SBINDIR@,${sbindir},g' \ |
135 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | 138 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ |
139 | -e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \ | ||
136 | ${D}${systemd_unitdir}/system/*.service | 140 | ${D}${systemd_unitdir}/system/*.service |
137 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | 141 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
138 | install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_unitdir}/system/ | 142 | install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_unitdir}/system/ |