From nobody Thu May 2 23:33:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1623131953; cv=none; d=zohomail.com; s=zohoarc; b=RYyIyRR9+cPEeuubRXbZ7eynV0HvBTK+uCXWoBLKqs3LgAUIGz7rzG/JjcgRdlDrE/gD8nYyDX07Tr8UuLjHVJrCflkutVWFxQ8rI4BrZndiiYRbifesqEikWEPONn0BXqed7736A7y3ahsiCb9Wf3EbHE+LBL1yZRWDSuDzEto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623131953; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i2oAt0R0s4NoNFYvZ9Mbyh4IYQkZZ3RW7YMkBQwQXlQ=; b=CHSKCS7fuDfep2l1Bzx+x8dHnfovt3B/SaTQ3m14PTsbR9ff6+DIvLKArQsuwLy76jU8esZV812lhvDXwwrZwbcP/2Od4GKy+wLC30NLq6ivm0fvIsIEJ1NFICS1Lmv25Df2Bg5Q5quQQLe5sMELwqGRibB7dR/+SC8aRGUNqII= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1623131953267262.04565590172103; Mon, 7 Jun 2021 22:59:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.138271.256003 (Exim 4.92) (envelope-from ) id 1lqUlG-0001Yy-OL; Tue, 08 Jun 2021 05:58:50 +0000 Received: by outflank-mailman (output) from mailman id 138271.256003; Tue, 08 Jun 2021 05:58:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lqUlG-0001Yr-L0; Tue, 08 Jun 2021 05:58:50 +0000 Received: by outflank-mailman (input) for mailman id 138271; Tue, 08 Jun 2021 05:58:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lqUlF-0001Yf-4T for xen-devel@lists.xenproject.org; Tue, 08 Jun 2021 05:58:49 +0000 Received: from smtp-out2.suse.de (unknown [195.135.220.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 35bf5c20-3fea-4264-85fe-236ddbfd58f0; Tue, 08 Jun 2021 05:58:47 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2A0BE1FD50; Tue, 8 Jun 2021 05:58:47 +0000 (UTC) Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id F27D6118DD; Tue, 8 Jun 2021 05:58:46 +0000 (UTC) Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id OBsOOhYHv2AQbAAALh3uQQ (envelope-from ); Tue, 08 Jun 2021 05:58:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 35bf5c20-3fea-4264-85fe-236ddbfd58f0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623131927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i2oAt0R0s4NoNFYvZ9Mbyh4IYQkZZ3RW7YMkBQwQXlQ=; b=UT64tIpTEgxopaXUTiBBPwXIcr65Zj2CYspcux64iBAXY0DjPoW02shBGW6+9SLPTz8KTn fwLooxuo3KfUqEhqwBY0DjZu6YRk7QGDLvX4DpI2PIjOec2A7qe08xqY3j9apXDc+hXSgi /5KB8sGFhaT2orkadCZF7j8zvKNvVj0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623131927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i2oAt0R0s4NoNFYvZ9Mbyh4IYQkZZ3RW7YMkBQwQXlQ=; b=UT64tIpTEgxopaXUTiBBPwXIcr65Zj2CYspcux64iBAXY0DjPoW02shBGW6+9SLPTz8KTn fwLooxuo3KfUqEhqwBY0DjZu6YRk7QGDLvX4DpI2PIjOec2A7qe08xqY3j9apXDc+hXSgi /5KB8sGFhaT2orkadCZF7j8zvKNvVj0= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu Subject: [PATCH v2 1/2] tools/xenstore: set oom score for xenstore daemon on Linux Date: Tue, 8 Jun 2021 07:58:38 +0200 Message-Id: <20210608055839.10313-2-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210608055839.10313-1-jgross@suse.com> References: <20210608055839.10313-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Xenstored is absolutely mandatory for a Xen host and it can't be restarted, so being killed by OOM-killer in case of memory shortage is to be avoided. Set /proc/$pid/oom_score_adj (if available) to -500 in order to allow xenstored to use large amounts of memory without being killed. Make sure the pid file isn't a left-over from a previous run delete it before starting xenstored. Signed-off-by: Juergen Gross Acked-by: Julien Grall --- V2: - set oom score from launch script (Julien Grall) - split off open file descriptor limit setting (Julien Grall) --- tools/hotplug/Linux/launch-xenstore.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/l= aunch-xenstore.in index 019f9d6f4d..3ad71e3d08 100644 --- a/tools/hotplug/Linux/launch-xenstore.in +++ b/tools/hotplug/Linux/launch-xenstore.in @@ -59,11 +59,14 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . = @CONFIG_DIR@/@CONFIG_LEAF echo "No xenstored found" exit 1 } + rm -f @XEN_RUN_DIR@/xenstored.pid =20 echo -n Starting $XENSTORED... $XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS =20 systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || exi= t 1 + XS_PID=3D`cat @XEN_RUN_DIR@/xenstored.pid` + echo -500 >/proc/$XS_PID/oom_score_adj =20 exit 0 } --=20 2.26.2 From nobody Thu May 2 23:33:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1623131952; cv=none; d=zohomail.com; s=zohoarc; b=Ll/UpfvBuWSimdJ0ij8WvUbkhXDZ9nFFB690Luu2euu0WNGCyQEkGR4YfBYrYM8y5DFaiLBLUpJnvgKtz/qP5gRAe020bryvVebae5HSt05p9vyItGRdv/DOs1JpjoEg/2kqehb1IsiOq5awsyx/EqxYe4M/14AC2iwbI06WEEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623131952; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yUf0kgQYfvnmKxevqLhHiJSctn5eVI9NLzOeej8C5tg=; b=CnasRKc/ePz0Ipw2JX/ynSbOCjp5r1XVcDuK9tBW58T1FDggipLHPaqGJnhNjQ6QNcEqkk6KR/EWGnMggutE+9gXVUEaSNVwOPFouH8aawB69h5ig5z4Hgg0FM7ohnQsBuCD0FNA39hqEXeIyNEmIWKO/iQrEfLFwJx2YIuTZyM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1623131952927562.1784443543073; Mon, 7 Jun 2021 22:59:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.138273.256027 (Exim 4.92) (envelope-from ) id 1lqUlL-00027U-7V; Tue, 08 Jun 2021 05:58:55 +0000 Received: by outflank-mailman (output) from mailman id 138273.256027; Tue, 08 Jun 2021 05:58:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lqUlL-00027L-3J; Tue, 08 Jun 2021 05:58:55 +0000 Received: by outflank-mailman (input) for mailman id 138273; Tue, 08 Jun 2021 05:58:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lqUlK-0001Yg-2p for xen-devel@lists.xenproject.org; Tue, 08 Jun 2021 05:58:54 +0000 Received: from smtp-out2.suse.de (unknown [195.135.220.29]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ab4b8d68-4dbf-4443-ae63-7e5e7247d28f; Tue, 08 Jun 2021 05:58:48 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5D71F1FD51; Tue, 8 Jun 2021 05:58:47 +0000 (UTC) Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 307B5118DD; Tue, 8 Jun 2021 05:58:47 +0000 (UTC) Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id AMWyChcHv2AQbAAALh3uQQ (envelope-from ); Tue, 08 Jun 2021 05:58:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ab4b8d68-4dbf-4443-ae63-7e5e7247d28f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623131927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yUf0kgQYfvnmKxevqLhHiJSctn5eVI9NLzOeej8C5tg=; b=JKQDlEuS9yvNBnHdV89lkxA+VM4Er1ZUn6rc79KzTdyfBNRTAudmIwkCb9qz73GYaZ1VN2 RxiYH4Fe9D0fPb+5C2SFjOR3nJf53T9izV87DbSCTzYPtZ+tGNdajcdBNUlcPkpzK2Tva7 7av2EmdgFA/WVAvTy1ejrR+4h0gu1cY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623131927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yUf0kgQYfvnmKxevqLhHiJSctn5eVI9NLzOeej8C5tg=; b=JKQDlEuS9yvNBnHdV89lkxA+VM4Er1ZUn6rc79KzTdyfBNRTAudmIwkCb9qz73GYaZ1VN2 RxiYH4Fe9D0fPb+5C2SFjOR3nJf53T9izV87DbSCTzYPtZ+tGNdajcdBNUlcPkpzK2Tva7 7av2EmdgFA/WVAvTy1ejrR+4h0gu1cY= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu Subject: [PATCH v2 2/2] tools/xenstore: set open file descriptor limit for xenstored Date: Tue, 8 Jun 2021 07:58:39 +0200 Message-Id: <20210608055839.10313-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210608055839.10313-1-jgross@suse.com> References: <20210608055839.10313-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 --- 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/hot= plug/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=3D@XENSTORED@ =20 +## Type: integer +## Default: 32768 +# +# Select maximum number of domains supported by xenstored. +# Only evaluated if XENSTORETYPE is "daemon". +#XENSTORED_MAX_N_DOMAINS=3D32768 + ## Type: string ## Default: "" # diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/l= aunch-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 =20 [ "$XENSTORETYPE" =3D "daemon" ] && { [ -z "$XENSTORED_TRACE" ] || XENSTORED_ARGS=3D"$XENSTORED_ARGS -T @XEN_LO= G_DIR@/xenstored-trace.log" + [ -z "$XENSTORED_MAX_N_DOMAINS" ] && XENSTORED_MAX_N_DOMAINS=3D32768 [ -z "$XENSTORED" ] && XENSTORED=3D@XENSTORED@ [ -x "$XENSTORED" ] || { echo "No xenstored found" exit 1 } rm -f @XEN_RUN_DIR@/xenstored.pid + N_FILES=3D$(($XENSTORED_MAX_N_DOMAINS * 5 + 100)) =20 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 && . @C= ONFIG_DIR@/@CONFIG_LEAF systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || exi= t 1 XS_PID=3D`cat @XEN_RUN_DIR@/xenstored.pid` echo -500 >/proc/$XS_PID/oom_score_adj + prlimit --pid $XS_PID --nofile=3D$N_FILES =20 exit 0 } --=20 2.26.2