kernel: sched: Configuring PELT half-life via Kconfig

Note that adjusting PELT half-life via kernel parameters is only allowed when CONFIG_PELT_UTIL_HALFLIFE_DEFAULT is selected.
This commit is contained in:
Pzqqt 2024-02-18 13:28:38 +08:00 committed by Ksawlii
parent c05672273a
commit 648fb626ad
2 changed files with 52 additions and 0 deletions

View file

@ -856,6 +856,42 @@ config UCLAMP_BUCKETS_COUNT
endmenu
menu "FAIR Scheuler tunables"
choice
prompt "Utilization's PELT half-Life"
default PELT_UTIL_HALFLIFE_DEFAULT
help
Allows choosing one of the possible values for the PELT half-life to
be used for the update of the utilization of tasks and CPUs.
The half-life is the amount of [ms] required by the PELT signal to
build up to 50% utilization. The higher the half-life the longer it
takes for a task to be represented as a big one.
Note that adjusting PELT half-life via kernel parameters is only
allowed when PELT_UTIL_HALFLIFE_DEFAULT is selected.
If not sure, use the default.
config PELT_UTIL_HALFLIFE_DEFAULT
bool "Default (32 ms)"
config PELT_UTIL_HALFLIFE_32
bool "32 ms"
config PELT_UTIL_HALFLIFE_16
bool "16 ms"
config PELT_UTIL_HALFLIFE_12
bool "12 ms"
config PELT_UTIL_HALFLIFE_8
bool "8 ms"
endchoice
endmenu # FAIR Scheduler tunables"
#
# For architectures that want to enable the support for NUMA-affine scheduler
# balancing logic:

View file

@ -28,9 +28,23 @@
#include "sched.h"
#include "pelt.h"
#if IS_ENABLED(CONFIG_PELT_UTIL_HALFLIFE_8)
int pelt_load_avg_period = PELT8_LOAD_AVG_PERIOD;
int pelt_load_avg_max = PELT8_LOAD_AVG_MAX;
const u32 *pelt_runnable_avg_yN_inv = pelt8_runnable_avg_yN_inv;
#elif IS_ENABLED(CONFIG_PELT_UTIL_HALFLIFE_12)
int pelt_load_avg_period = PELT12_LOAD_AVG_PERIOD;
int pelt_load_avg_max = PELT12_LOAD_AVG_MAX;
const u32 *pelt_runnable_avg_yN_inv = pelt12_runnable_avg_yN_inv;
#elif IS_ENABLED(CONFIG_PELT_UTIL_HALFLIFE_16)
int pelt_load_avg_period = PELT16_LOAD_AVG_PERIOD;
int pelt_load_avg_max = PELT16_LOAD_AVG_MAX;
const u32 *pelt_runnable_avg_yN_inv = pelt16_runnable_avg_yN_inv;
#elif IS_ENABLED(CONFIG_PELT_UTIL_HALFLIFE_DEFAULT) || IS_ENABLED(CONFIG_PELT_UTIL_HALFLIFE_32)
int pelt_load_avg_period = PELT32_LOAD_AVG_PERIOD;
int pelt_load_avg_max = PELT32_LOAD_AVG_MAX;
const u32 *pelt_runnable_avg_yN_inv = pelt32_runnable_avg_yN_inv;
#endif
int get_pelt_halflife(void)
{
@ -71,6 +85,7 @@ int set_pelt_halflife(int num)
}
EXPORT_SYMBOL_GPL(set_pelt_halflife);
#if IS_ENABLED(CONFIG_PELT_UTIL_HALFLIFE_DEFAULT)
static int __init set_pelt(char *str)
{
int rc, num;
@ -86,6 +101,7 @@ static int __init set_pelt(char *str)
}
early_param("pelt", set_pelt);
#endif
/*
* Approximate: