File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,25 @@ static const char *get_svc_name(const char *arg)
219
219
return arg ? arg : " MySQL" ;
220
220
}
221
221
222
+ /*
223
+ Disable CPU throttling for the process.
224
+
225
+ Windows 11 heuristics misdetects server as a background process and runs it
226
+ on "efficiency" cores, in hybrid architectures such as Alder Lake (12th
227
+ generation Intel Core).This results in serious performance degradation.
228
+ */
229
+ void disable_cpu_throttling ()
230
+ {
231
+ #ifdef PROCESS_POWER_THROTTLING_EXECUTION_SPEED
232
+ PROCESS_POWER_THROTTLING_STATE power_throttling{};
233
+ power_throttling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
234
+ power_throttling.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
235
+ power_throttling.StateMask = 0 ;
236
+ SetProcessInformation (GetCurrentProcess (), ProcessPowerThrottling,
237
+ &power_throttling, sizeof (power_throttling));
238
+ #endif
239
+ }
240
+
222
241
/*
223
242
Main function on Windows.
224
243
Runs mysqld as normal process, or as a service.
@@ -230,6 +249,7 @@ __declspec(dllexport) int mysqld_win_main(int argc, char **argv)
230
249
save_argv= argv;
231
250
save_argc= argc;
232
251
252
+ disable_cpu_throttling ();
233
253
/*
234
254
If no special arguments are given, service name is nor present
235
255
run as normal program.
You can’t perform that action at this time.
0 commit comments