All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre McCurdy <armccurdy@gmail.com>
To: Hongxu Jia <hongxu.jia@windriver.com>
Cc: OE Core mailing list <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH V2] systemd: add menson option to decrease RLIMIT_NOFILE on qemu bsp
Date: Mon, 19 Aug 2019 12:04:58 -0700	[thread overview]
Message-ID: <CAJ86T=WtuV46YbMMcGigKRrsvTNTtgWWdNLDp2P27-Zx6Rn+Yw@mail.gmail.com> (raw)
In-Reply-To: <1566232619-199878-1-git-send-email-hongxu.jia@windriver.com>

On Mon, Aug 19, 2019 at 9:38 AM Hongxu Jia <hongxu.jia@windriver.com> wrote:
>
> 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 allocates memory according to RLIMIT_NOFILE,
> so decrease RLIMIT_NOFILE to 4k to keep sync with sysvinit
>
> After applying the patch, the memory cost is the same with sysvinit
> rpcuser    340  0.0  1.0   3212  2588 ?        Ss   13:20   0:00 /usr/sbin/rpc.statd -F
> root       473  0.0  0.2   3464   496 ?        Ss   13:23   0:00 /usr/sbin/rpc.mountd
>
> For other bsp, still keep RLIMIT_NOFILE to 512k by default
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>  ...001-meson-add-option-to-set-RLIMIT_NOFILE.patch | 50 ++++++++++++++++++++++
>  meta/recipes-core/systemd/systemd_242.bb           |  5 +++
>  2 files changed, 55 insertions(+)
>  create mode 100644 meta/recipes-core/systemd/systemd/0001-meson-add-option-to-set-RLIMIT_NOFILE.patch
>
> diff --git a/meta/recipes-core/systemd/systemd/0001-meson-add-option-to-set-RLIMIT_NOFILE.patch b/meta/recipes-core/systemd/systemd/0001-meson-add-option-to-set-RLIMIT_NOFILE.patch
> new file mode 100644
> index 0000000..e822238
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0001-meson-add-option-to-set-RLIMIT_NOFILE.patch
> @@ -0,0 +1,50 @@
> +From d42d1512402de0d2249e2d68040c5c3887e7ea99 Mon Sep 17 00:00:00 2001
> +From: Hongxu Jia <hongxu.jia@windriver.com>
> +Date: Mon, 19 Aug 2019 12:06:59 -0400
> +Subject: [PATCH] meson: add option to set RLIMIT_NOFILE
> +
> +Add option to set RLIMIT_NOFILE and keep 512*1024 by default
> +
> +It is helpful for embedded device which has memory limitation
> +to decrease RLIMIT_NOFILE
> +
> +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/13359]
> +
> +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> +---
> + meson.build       | 2 +-
> + meson_options.txt | 5 +++++
> + 2 files changed, 6 insertions(+), 1 deletion(-)
> +
> +diff --git a/meson.build b/meson.build
> +index 18a7cc5..26d9cf0 100644
> +--- a/meson.build
> ++++ b/meson.build
> +@@ -79,7 +79,7 @@ conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
> +
> + conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
> + conf.set10('BUMP_PROC_SYS_FS_NR_OPEN',  get_option('bump-proc-sys-fs-nr-open'))
> +-conf.set('HIGH_RLIMIT_NOFILE',          512*1024)
> ++conf.set('HIGH_RLIMIT_NOFILE',          get_option('high-rlimit-nofile'))
> +
> + # join_paths ignores the preceding arguments if an absolute component is
> + # encountered, so this should canonicalize various paths when they are
> +diff --git a/meson_options.txt b/meson_options.txt
> +index d4ec37d..5d4ee18 100644
> +--- a/meson_options.txt
> ++++ b/meson_options.txt
> +@@ -56,6 +56,11 @@ option('bump-proc-sys-fs-file-max', type : 'boolean',
> +        description : 'bump /proc/sys/fs/file-max to ULONG_MAX')
> + option('bump-proc-sys-fs-nr-open', type : 'boolean',
> +        description : 'bump /proc/sys/fs/nr_open to INT_MAX')
> ++
> ++# Default is 512*1024
> ++option('high-rlimit-nofile', type : 'integer', value : 524288,
> ++       description : 'set RLIMIT_NOFILE')
> ++
> + option('valgrind', type : 'boolean', value : false,
> +        description : 'do extra operations to avoid valgrind warnings')
> + option('log-trace', type : 'boolean', value : false,
> +--
> +2.8.1
> +
> diff --git a/meta/recipes-core/systemd/systemd_242.bb b/meta/recipes-core/systemd/systemd_242.bb
> index 1953fef..96a53dc 100644
> --- a/meta/recipes-core/systemd/systemd_242.bb
> +++ b/meta/recipes-core/systemd/systemd_242.bb
> @@ -28,6 +28,7 @@ SRC_URI += "file://touchscreen.rules \
>             file://0001-core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-.patch \
>             file://0001-networkd-fix-link-up.patch \
>             file://0002-network-do-not-send-ipv6.patch \
> +           file://0001-meson-add-option-to-set-RLIMIT_NOFILE.patch \
>             "
>
>  # patches needed by musl
> @@ -211,6 +212,10 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
>                    -Dsulogin-path=${base_sbindir}/sulogin \
>                    -Dumount-path=${base_bindir}/umount"
>
> +EXTRA_OEMESON += "-Dhigh-rlimit-nofile=${RLIMIT_NOFILE}"
> +RLIMIT_NOFILE ??= "524288"
> +RLIMIT_NOFILE_qemuall ?= "4096"

This doesn't look right. By making the fix qemu specific you're
effectively changing the QA tests to pass - but leaving the underlying
issue there for all real world use cases.

Better to set the safe value by default and let users with lots of
memory change it if they need to.

> +
>  do_install() {
>         meson_do_install
>         install -d ${D}/${base_sbindir}
> --
> 2.8.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


  reply	other threads:[~2019-08-19 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 13:33 [PATCH] systemd: decreasing default RLIMIT_NOFILE on qemu bsp Hongxu Jia
2019-08-19 14:01 ` Alexander Kanavin
2019-08-19 14:25   ` Hongxu Jia
2019-08-19 14:41     ` Alexander Kanavin
2019-08-19 16:36       ` [PATCH V2] systemd: add menson option to decrease " Hongxu Jia
2019-08-19 19:04         ` Andre McCurdy [this message]
2019-08-20  5:45           ` [PATCH V3] nfs-utils: decrease RLIMIT_NOFILE to 4k for systemd Hongxu Jia
2019-08-27  9:43             ` Kang Kai
2019-08-27 23:29               ` richard.purdie
2019-08-28  1:29                 ` Kang Kai
2019-08-28 15:55                   ` richard.purdie
2019-08-19 14:55   ` [PATCH] systemd: decreasing default RLIMIT_NOFILE on qemu bsp richard.purdie
2019-08-19 16:00     ` Alexander Kanavin
2019-08-20 13:46     ` Mark Hatle
2019-08-20 16:38       ` Adrian Bunk
2019-08-21  0:23         ` Mark Hatle
2019-08-20 20:20       ` Alexander Kanavin
2019-08-21 21:01         ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ86T=WtuV46YbMMcGigKRrsvTNTtgWWdNLDp2P27-Zx6Rn+Yw@mail.gmail.com' \
    --to=armccurdy@gmail.com \
    --cc=hongxu.jia@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.