From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>, Ian Jackson <iwj@xenproject.org>,
Wei Liu <wl@xen.org>
Subject: [PATCH v2 2/2] tools/xenstore: set open file descriptor limit for xenstored
Date: Tue, 8 Jun 2021 07:58:39 +0200 [thread overview]
Message-ID: <20210608055839.10313-3-jgross@suse.com> (raw)
In-Reply-To: <20210608055839.10313-1-jgross@suse.com>
Add a configuration item for the maximum number of domains xenstored
should support and set the limit of open file descriptors accordingly.
For HVM domains there are up to 5 socket connections per domain (2 by
the xl daemon process, and 3 by qemu). So set the ulimit for xenstored
to 5 * XENSTORED_MAX_DOMAINS + 100 (the "+ 100" is for some headroom,
like logging, event channel device, etc.).
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- set ulimit form launch script (Julien Grall)
- split off from original patch (Julien Grall)
---
tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 7 +++++++
tools/hotplug/Linux/launch-xenstore.in | 3 +++
2 files changed, 10 insertions(+)
diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
index 00cf7f91d4..516cd97092 100644
--- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -32,6 +32,13 @@
# Changing this requires a reboot to take effect.
#XENSTORED=@XENSTORED@
+## Type: integer
+## Default: 32768
+#
+# Select maximum number of domains supported by xenstored.
+# Only evaluated if XENSTORETYPE is "daemon".
+#XENSTORED_MAX_N_DOMAINS=32768
+
## Type: string
## Default: ""
#
diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in
index 3ad71e3d08..89149f98ee 100644
--- a/tools/hotplug/Linux/launch-xenstore.in
+++ b/tools/hotplug/Linux/launch-xenstore.in
@@ -54,12 +54,14 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF
[ "$XENSTORETYPE" = "daemon" ] && {
[ -z "$XENSTORED_TRACE" ] || XENSTORED_ARGS="$XENSTORED_ARGS -T @XEN_LOG_DIR@/xenstored-trace.log"
+ [ -z "$XENSTORED_MAX_N_DOMAINS" ] && XENSTORED_MAX_N_DOMAINS=32768
[ -z "$XENSTORED" ] && XENSTORED=@XENSTORED@
[ -x "$XENSTORED" ] || {
echo "No xenstored found"
exit 1
}
rm -f @XEN_RUN_DIR@/xenstored.pid
+ N_FILES=$(($XENSTORED_MAX_N_DOMAINS * 5 + 100))
echo -n Starting $XENSTORED...
$XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
@@ -67,6 +69,7 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF
systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || exit 1
XS_PID=`cat @XEN_RUN_DIR@/xenstored.pid`
echo -500 >/proc/$XS_PID/oom_score_adj
+ prlimit --pid $XS_PID --nofile=$N_FILES
exit 0
}
--
2.26.2
next prev parent reply other threads:[~2021-06-08 5:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 5:58 [PATCH v2 0/2] tools/xenstore: set resource limits of xenstored Juergen Gross
2021-06-08 5:58 ` [PATCH v2 1/2] tools/xenstore: set oom score for xenstore daemon on Linux Juergen Gross
2021-07-08 17:40 ` Julien Grall
2021-07-09 12:34 ` Juergen Gross
2021-07-12 8:38 ` Julien Grall
2021-06-08 5:58 ` Juergen Gross [this message]
2021-06-08 16:39 ` [PATCH v2 2/2] tools/xenstore: set open file descriptor limit for xenstored Olaf Hering
2021-06-11 5:01 ` Juergen Gross
2021-06-11 5:46 ` Olaf Hering
2021-06-11 7:07 ` Juergen Gross
2021-06-11 7:28 ` Olaf Hering
2021-07-07 7:23 ` [PATCH v2 0/2] tools/xenstore: set resource limits of xenstored Juergen Gross
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=20210608055839.10313-3-jgross@suse.com \
--to=jgross@suse.com \
--cc=iwj@xenproject.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).