From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id F1B5E192B026; Tue, 13 Jan 2026 18:31:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F1B5E192B026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1768318315; bh=cYZTWInm1nM14E2nep0ox84oMhEMM/Yk9DKA4oqGw9s=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=dAA8qTJDiatbCVqoWVMm4KLOsCVPFe4mOqPF9bQKTmBVYwqUXM6Fa0YuSpw7/jNPi ppxZeYiya/g2E3NDZa2LPVb6q47E+Qscu6jkOoWwW0H1whyHQfKi02Hfiu3eJdYxHj GNeXScHd0jskcPCxhIGJWhlM/TL+Sg3ehEKTI2pw= Received: from send277.i.mail.ru (send277.i.mail.ru [95.163.59.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2BEBC192B022 for ; Tue, 13 Jan 2026 18:31:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2BEBC192B022 Received: by exim-smtp-7b4fb89df9-ll72k with esmtpa (envelope-from ) id 1vfgN6-000000008V5-0GLx; Tue, 13 Jan 2026 18:31:52 +0300 Content-Type: multipart/alternative; boundary="------------8DEFY44xSkzLdajK0pqGa87P" Message-ID: <86be55de-2fc3-4847-9d32-60682c9f6db2@tarantool.org> Date: Tue, 13 Jan 2026 18:31:51 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <17eca2e353ca35724c022af610f1295328838561.1766738771.git.skaplun@tarantool.org> In-Reply-To: <17eca2e353ca35724c022af610f1295328838561.1766738771.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD136B1DE29D0A14186819F7335A1BEA2E182A05F538085040AE0A835325BAAE223DE06ABAFEAF67059F34480E39800701B2CDCC1786F964BCB6A098A45AF874EE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79145AB6E9E75F07EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566DDAE7ACB9D63E4C45F8F010EBCB5EBD4A229625AE147A5855575BD37C64D9A5D389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224958C1606C78F2434E76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B6A4E49BB0F3BA1413AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73589424AA0EF8DE9BAC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5A282A54B720557C25002B1117B3ED696CAA55CF412F4A5A14A0A47EBA01A636A823CB91A9FED034534781492E4B8EEAD6A17C1D737525568BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6591EA8EC120A1D4CED3B4D102B574D7B41E2C0519C8E6182A1CE4177A1F5DFF6B04A1A099E65EB121FB8341EE9D5BE9A0A68C83F066742FFCACCE8613A3736C20B2301FE372A91F1188CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVVt0N+pdRHOZFbLnrsDuEZE= X-Mailru-Sender: 811C44EDE0507D1FFB106D83BFFB684F95C1B9D8F0A144345E07F309F87FFB14A6EACE51573BA9D20300086A5687A359645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 39/41] perf: add a script for the environment setup X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------8DEFY44xSkzLdajK0pqGa87P Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the patch! LGTM with minor comment below. Sergey On 12/26/25 12:18, Sergey Kaplun wrote: > The patch adds a script for setting the environment before running > performance tests. The script originated from the Tarantool's repository > [2]. Most of the settings are taken from the Tarantool's wiki page > dedicated to the benchmarking [1]. > > [1]:https://github.com/tarantool/tarantool/blob/dcdb3ee83b3d6324011e704b5a3f4ee3e19bbf47/perf/tools/setup_env.sh > [2]:https://github.com/tarantool/tarantool/wiki/Benchmarking > --- > perf/helpers/setup_env.sh | 135 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 135 insertions(+) > create mode 100755 perf/helpers/setup_env.sh > > diff --git a/perf/helpers/setup_env.sh b/perf/helpers/setup_env.sh > new file mode 100755 > index 00000000..043d3c88 > --- /dev/null > +++ b/perf/helpers/setup_env.sh > @@ -0,0 +1,135 @@ > +#!/bin/sh I propose to add a note to the comments that the original version of script is in the tarantool repository. > + > +# The script sets up a Linux operating system before running > +# LuaJIT benchmarks. See more details in [1]. > +# > +# [1]:https://github.com/tarantool/tarantool/wiki/Benchmarking > + > +set -eu > + > +uid=$(id -u) > +if [ "$uid" -ne 0 ] > + then echo "Please run as root." > + exit 1 > +fi > + > +### > +# Helpers. > +### > + > +cpu_vendor="unknown" > +cpuinfo_vendor=$(awk '/vendor_id/{ print $3; exit }' < /proc/cpuinfo) > +if [ "$cpuinfo_vendor" = "GenuineIntel" ]; then > + cpu_vendor="intel" > +elif [ "$cpuinfo_vendor" = "AuthenticAMD" ]; then > + cpu_vendor="amd" > +else > + echo "Unknown CPU vendor '$cpuinfo_vendor'" > + exit 1 > +fi > + > +FAILURE_MSG="WARNING" > +SUCCESS_MSG="CHECKED" > +SKIPPED_MSG="SKIPPED" > + > +set_kernel_setting() { > + desc_msg="$1" > + file_path="$2" > + value="$3" > + > + if [ -f "$file_path" ]; then > + sh -c "echo $value > $file_path" && status="$SUCCESS_MSG" || status="$FAILURE_MSG" > + else > + status="$SKIPPED_MSG" > + fi > + echo "$desc_msg $status" > +} > + > +kernel_setting_is_nonzero() { > + desc_msg="$1" > + file_path="$2" > + hint_msg="$3" > + > + if [ -f "$file_path" ]; then > + value=$(cat "$file_path") > + if [ -n "$value" ]; then > + status="$SUCCESS_MSG" > + else > + status="$FAILURE_MSG (hint: $hint_msg)" > + fi > + else > + status="$SKIPPED_MSG" > + fi > + echo "$desc_msg $status" > +} > + > +### > +# Kernel command line parameters. > +### > + > +desc_msg="Disable AMD SMT or Intel Hyperthreading " > +sysfs_path="/sys/devices/system/cpu/smt/active" > +if [ -f "$sysfs_path" ]; then > + is_set=$(cat $sysfs_path) > + err_msg="$FAILURE_MSG (hint: set 'nosmt' kernel parameter)" > + [ "$is_set" = 1 ] && status="$SUCCESS_MSG" || status="$err_msg" > +else > + status="$SKIPPED_MSG" > +fi > +echo "$desc_msg $status" > + > +kernel_setting_is_nonzero \ > + "Isolate CPUs for benchmarking" \ > + "/sys/devices/system/cpu/isolated" \ > + "set 'isolcpus' kernel parameter" > + > +kernel_setting_is_nonzero \ > + "Offload interrupts from the isolated CPUs" \ > + "/proc/irq/default_smp_affinity" \ > + "set 'irqaffinity' kernel parameter" > + > +kernel_setting_is_nonzero \ > + "Disable scheduling on single-task isolated CPUs" \ > + "/sys/devices/system/cpu/nohz_full" \ > + "set 'nohz_full' kernel parameter" > + > +set_kernel_setting \ > + "Disable transparent huge pages" \ > + "/sys/kernel/mm/transparent_hugepage/enabled" \ > + "never" > + > +set_kernel_setting \ > + "Disable direct compaction of transparent huge pages" \ > + "/sys/kernel/mm/transparent_hugepage/defrag" \ > + "never" > + > +# Disable ASLR for the repeatable LuaJIT behaviour. > +set_kernel_setting \ > + "Disable ASLR" \ > + "/proc/sys/kernel/randomize_va_space" \ > + "0" > + > +### > +# System tuning. > +### > + > +if [ "$cpu_vendor" = "amd" ]; then > + sysfs_path="/sys/devices/system/cpu/cpufreq/boost" > + value=0 > +elif [ "$cpu_vendor" = "intel" ]; then > + sysfs_path="/sys/devices/system/cpu/intel_pstate/no_turbo" > + value=1 > +fi > +set_kernel_setting \ > + "Disable TurboBoost" \ > + "$sysfs_path" \ > + "$value" > + > +ncpu=$(getconf _NPROCESSORS_ONLN) > +for cpu_id in $(seq 0 1 $((ncpu-1))); do > + sysfs_path_cpu="/sys/devices/system/cpu/cpu$cpu_id/cpufreq/scaling_governor" > + set_kernel_setting \ > + "Stabilize the frequency of CPU $cpu_id" \ > + "$sysfs_path_cpu" \ > + "performance" > +done --------------8DEFY44xSkzLdajK0pqGa87P Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the patch! LGTM with minor comment below.

Sergey

On 12/26/25 12:18, Sergey Kaplun wrote:
The patch adds a script for setting the environment before running
performance tests. The script originated from the Tarantool's repository
[2]. Most of the settings are taken from the Tarantool's wiki page
dedicated to the benchmarking [1].

[1]: https://github.com/tarantool/tarantool/blob/dcdb3ee83b3d6324011e704b5a3f4ee3e19bbf47/perf/tools/setup_env.sh
[2]: https://github.com/tarantool/tarantool/wiki/Benchmarking
---
 perf/helpers/setup_env.sh | 135 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100755 perf/helpers/setup_env.sh

diff --git a/perf/helpers/setup_env.sh b/perf/helpers/setup_env.sh
new file mode 100755
index 00000000..043d3c88
--- /dev/null
+++ b/perf/helpers/setup_env.sh
@@ -0,0 +1,135 @@
+#!/bin/sh
I propose to add a note to the comments that the original version of script is in the tarantool repository.
+
+# The script sets up a Linux operating system before running
+# LuaJIT benchmarks. See more details in [1].
+#
+# [1]: https://github.com/tarantool/tarantool/wiki/Benchmarking
+
+set -eu
+
+uid=$(id -u)
+if [ "$uid" -ne 0 ]
+  then echo "Please run as root."
+  exit 1
+fi
+
+###
+# Helpers.
+###
+
+cpu_vendor="unknown"
+cpuinfo_vendor=$(awk '/vendor_id/{ print $3; exit }' < /proc/cpuinfo)
+if [ "$cpuinfo_vendor" = "GenuineIntel" ]; then
+  cpu_vendor="intel"
+elif [ "$cpuinfo_vendor" = "AuthenticAMD" ]; then
+  cpu_vendor="amd"
+else
+  echo "Unknown CPU vendor '$cpuinfo_vendor'"
+  exit 1
+fi
+
+FAILURE_MSG="WARNING"
+SUCCESS_MSG="CHECKED"
+SKIPPED_MSG="SKIPPED"
+
+set_kernel_setting() {
+  desc_msg="$1"
+  file_path="$2"
+  value="$3"
+
+  if [ -f "$file_path" ]; then
+    sh -c "echo $value > $file_path" && status="$SUCCESS_MSG" || status="$FAILURE_MSG"
+  else
+    status="$SKIPPED_MSG"
+  fi
+  echo "$desc_msg $status"
+}
+
+kernel_setting_is_nonzero() {
+  desc_msg="$1"
+  file_path="$2"
+  hint_msg="$3"
+
+  if [ -f "$file_path" ]; then
+    value=$(cat "$file_path")
+    if [ -n "$value" ]; then
+      status="$SUCCESS_MSG"
+    else
+      status="$FAILURE_MSG (hint: $hint_msg)"
+    fi
+  else
+    status="$SKIPPED_MSG"
+  fi
+  echo "$desc_msg $status"
+}
+
+###
+# Kernel command line parameters.
+###
+
+desc_msg="Disable AMD SMT or Intel Hyperthreading "
+sysfs_path="/sys/devices/system/cpu/smt/active"
+if [ -f "$sysfs_path" ]; then
+  is_set=$(cat $sysfs_path)
+  err_msg="$FAILURE_MSG (hint: set 'nosmt' kernel parameter)"
+  [ "$is_set" = 1 ] && status="$SUCCESS_MSG" || status="$err_msg"
+else
+  status="$SKIPPED_MSG"
+fi
+echo "$desc_msg $status"
+
+kernel_setting_is_nonzero \
+  "Isolate CPUs for benchmarking" \
+  "/sys/devices/system/cpu/isolated" \
+  "set 'isolcpus' kernel parameter"
+
+kernel_setting_is_nonzero \
+  "Offload interrupts from the isolated CPUs" \
+  "/proc/irq/default_smp_affinity" \
+  "set 'irqaffinity' kernel parameter"
+
+kernel_setting_is_nonzero \
+  "Disable scheduling on single-task isolated CPUs" \
+  "/sys/devices/system/cpu/nohz_full" \
+  "set 'nohz_full' kernel parameter"
+
+set_kernel_setting \
+  "Disable transparent huge pages" \
+  "/sys/kernel/mm/transparent_hugepage/enabled" \
+  "never"
+
+set_kernel_setting \
+  "Disable direct compaction of transparent huge pages" \
+  "/sys/kernel/mm/transparent_hugepage/defrag" \
+  "never"
+
+# Disable ASLR for the repeatable LuaJIT behaviour.
+set_kernel_setting \
+  "Disable ASLR" \
+  "/proc/sys/kernel/randomize_va_space" \
+  "0"
+
+###
+# System tuning.
+###
+
+if [ "$cpu_vendor" = "amd" ]; then
+  sysfs_path="/sys/devices/system/cpu/cpufreq/boost"
+  value=0
+elif [ "$cpu_vendor" = "intel" ]; then
+  sysfs_path="/sys/devices/system/cpu/intel_pstate/no_turbo"
+  value=1
+fi
+set_kernel_setting \
+  "Disable TurboBoost" \
+  "$sysfs_path" \
+  "$value"
+
+ncpu=$(getconf _NPROCESSORS_ONLN)
+for cpu_id in $(seq 0 1 $((ncpu-1))); do
+  sysfs_path_cpu="/sys/devices/system/cpu/cpu$cpu_id/cpufreq/scaling_governor"
+  set_kernel_setting \
+    "Stabilize the frequency of CPU $cpu_id" \
+    "$sysfs_path_cpu" \
+    "performance"
+done
--------------8DEFY44xSkzLdajK0pqGa87P--