summaryrefslogtreecommitdiffstats
path: root/sql/winmain.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 13:22:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 13:22:53 +0000
commit347c164c35eddab388009470e6848cb361ac93f8 (patch)
tree2c0c44eac690f510bb0a35b2a13b36d606b77b6b /sql/winmain.cc
parentReleasing progress-linux version 1:10.11.7-4~progress7.99u1. (diff)
downloadmariadb-347c164c35eddab388009470e6848cb361ac93f8.tar.xz
mariadb-347c164c35eddab388009470e6848cb361ac93f8.zip
Merging upstream version 1:10.11.8.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/winmain.cc')
-rw-r--r--sql/winmain.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/winmain.cc b/sql/winmain.cc
index 2ed43130..ff409a6d 100644
--- a/sql/winmain.cc
+++ b/sql/winmain.cc
@@ -221,6 +221,25 @@ static const char *get_svc_name(const char *arg)
}
/*
+ Disable CPU throttling for the process.
+
+ Windows 11 heuristics misdetects server as a background process and runs it
+ on "efficiency" cores, in hybrid architectures such as Alder Lake (12th
+ generation Intel Core).This results in serious performance degradation.
+*/
+void disable_cpu_throttling()
+{
+#ifdef PROCESS_POWER_THROTTLING_EXECUTION_SPEED
+ PROCESS_POWER_THROTTLING_STATE power_throttling{};
+ power_throttling.Version= PROCESS_POWER_THROTTLING_CURRENT_VERSION;
+ power_throttling.ControlMask= PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
+ power_throttling.StateMask= 0;
+ SetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling,
+ &power_throttling, sizeof(power_throttling));
+#endif
+}
+
+/*
Main function on Windows.
Runs mysqld as normal process, or as a service.
@@ -231,6 +250,7 @@ __declspec(dllexport) int mysqld_win_main(int argc, char **argv)
save_argv= argv;
save_argc= argc;
+ disable_cpu_throttling();
/*
If no special arguments are given, service name is nor present
run as normal program.