From 1bc9b1288aeb6acbf89176c32f54b715b525b311 Mon Sep 17 00:00:00 2001 From: Wang Defa Date: Fri, 23 Jan 2026 11:47:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=A4=A7=E9=A1=B5?= =?UTF-8?q?=E5=86=85=E5=AD=98=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E5=AE=89=E8=A3=85=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/xxxigcc-daemon.service | 2 ++ script/install.deb.sh | 11 +++++++++++ script/install.sh | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/debian/xxxigcc-daemon.service b/debian/xxxigcc-daemon.service index a00d3a8..a50728b 100644 --- a/debian/xxxigcc-daemon.service +++ b/debian/xxxigcc-daemon.service @@ -33,6 +33,8 @@ SyslogIdentifier=xxxigcc-daemon # 资源限制 LimitNOFILE=65535 +LimitMEMLOCK=infinity +AmbientCapabilities=CAP_IPC_LOCK [Install] WantedBy=multi-user.target diff --git a/script/install.deb.sh b/script/install.deb.sh index 66c7193..40cd845 100755 --- a/script/install.deb.sh +++ b/script/install.deb.sh @@ -101,6 +101,16 @@ configure_cpu_rx() { jq ".cpu.$field = [ $rx_array ]" "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" } +# 配置大页内存 +configure_hugepages() { + if [[ "$one_gb_pages" == "true" ]]; then + log "$BLUE" "配置 大页内存..." + sysctl -w vm.nr_hugepages=3072 + echo "vm.nr_hugepages=3072" >>/etc/sysctl.conf + log "$GREEN" "大页内存配置完成" + fi +} + # 更新配置文件 replace_config() { [[ ! -f "$CONFIG_FILE" ]] && error "配置文件缺失" @@ -137,6 +147,7 @@ replace_config() { jq "$jq_cmd" "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" configure_cpu_rx + configure_hugepages } show_usage() { diff --git a/script/install.sh b/script/install.sh index 38461b7..157eebb 100644 --- a/script/install.sh +++ b/script/install.sh @@ -108,6 +108,16 @@ configure_cpu_rx() { jq ".cpu.$field = [ $rx_array ]" "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" } +# 配置大页内存 +configure_hugepages() { + if [[ "$one_gb_pages" == "true" ]]; then + log "$BLUE" "配置 大页内存..." + sysctl -w vm.nr_hugepages=3072 + echo "vm.nr_hugepages=3072" >>/etc/sysctl.conf + log "$GREEN" "大页内存配置完成" + fi +} + # 更新配置文件 replace_config() { [[ ! -f "$CONFIG_FILE" ]] && error "配置文件缺失" @@ -144,6 +154,7 @@ replace_config() { jq "$jq_cmd" "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" configure_cpu_rx + configure_hugepages } # 创建并启动服务