sysctl: Introduce compatibility layer to appease OOS when !SCHED_WALT

Based on 441d1a2 ("sysctl: Expose a few additional sched features to appease OOS when !SCHED_WALT")

This creates a set of no-op proc nodes to stand in for certain
features specific to SCHED_WALT for the purpose of appeasing
userspace and preventing runaway error spamming to logcat during
interactions, e.g.

ANDR-PERF-UTIL
Failed to read /proc/sys/kernel/sched_busy_hyst_ns
ANDR-PERF-OPTSHANDLER
Failed to read /proc/sys/kernel/sched_busy_hyst_ns

ANDR-PERF-UTIL
Failed to read /proc/sys/kernel/sched_prefer_spread
ANDR-PERF-OPTSHANDLER
Failed to read /proc/sys/kernel/sched_prefer_spread

ANDR-PERF-UTIL
Failed to read /proc/sys/kernel/sched_busy_hysteresis_enable_cpus
ANDR-PERF-OPTSHANDLER
Failed to read /proc/sys/kernel/sched_busy_hysteresis_enable_cpus

Please note that these nodes do not function properly, or at all,
and exist solely to provide CAF's performance HAL with something
to read and write meaningless numbers to.

Change-Id: I17dcd6def7ce4dcbc1a4be2b51727e85a18c050e
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Adam W. Willis 2023-09-19 18:03:24 +03:00 committed by Richard Raya
parent 0c742dcf59
commit 9ae04b26cd
3 changed files with 87 additions and 0 deletions

View File

@ -62,6 +62,16 @@ extern unsigned int sysctl_preemptoff_tracing_threshold_ns;
extern unsigned int sysctl_irqsoff_tracing_threshold_ns;
#endif
#ifdef CONFIG_PELT_COMPATIBILITY_LAYER
static unsigned int sysctl_sched_boost;
static unsigned int sysctl_sched_prefer_spread;
static unsigned int sysctl_sched_busy_hyst_enable_cpus;
static unsigned int sysctl_sched_busy_hyst;
static unsigned int sysctl_sched_group_upmigrate_pct;
static unsigned int sysctl_sched_group_downmigrate_pct;
static unsigned int sysctl_sched_ravg_window_nr_ticks;
#endif /* CONFIG_PELT_COMPATIBILITY_LAYER */
enum sched_tunable_scaling {
SCHED_TUNABLESCALING_NONE,
SCHED_TUNABLESCALING_LOG,

View File

@ -697,6 +697,16 @@ config PELT_UTIL_HALFLIFE_8
endchoice
config PELT_COMPATIBILITY_LAYER
bool "Compatibility layer for Qualcomm performance HALs"
default y
depends on !SCHED_WALT
help
This option enables a non-operational compatibility layer for use in
lieu of Window Assisted Load Tracking on systems which expect it.
If unsure, say N.
endmenu # FAIR Scheduler tunables"
#

View File

@ -133,6 +133,11 @@ static unsigned long one_ul = 1;
static unsigned long long_max = LONG_MAX;
static int one_hundred = 100;
static int one_thousand = 1000;
#ifdef CONFIG_PELT_COMPATIBILITY_LAYER
static unsigned int ns_per_sec = NSEC_PER_SEC;
static unsigned int __read_mostly sysctl_sched_group_upmigrate_pct = 100;
static unsigned int __read_mostly sysctl_sched_group_downmigrate_pct = 95;
#endif /* CONFIG_PELT_COMPATIBILITY_LAYER */
#ifdef CONFIG_SCHED_WALT
static int two_million = 2000000;
#endif
@ -343,6 +348,68 @@ static int max_extfrag_threshold = 1000;
#endif
static struct ctl_table kern_table[] = {
#ifdef CONFIG_PELT_COMPATIBILITY_LAYER
{
.procname = "sched_boost",
.data = &sysctl_sched_boost,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &neg_three,
.extra2 = &three,
},
{
.procname = "sched_prefer_spread",
.data = &sysctl_sched_prefer_spread,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &four,
},
{
.procname = "sched_busy_hysteresis_enable_cpus",
.data = &sysctl_sched_busy_hyst_enable_cpus,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &two_hundred_fifty_five,
},
{
.procname = "sched_busy_hyst_ns",
.data = &sysctl_sched_busy_hyst,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &ns_per_sec,
},
{
.procname = "sched_group_upmigrate",
.data = &sysctl_sched_group_upmigrate_pct,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &sysctl_sched_group_downmigrate_pct,
},
{
.procname = "sched_group_downmigrate",
.data = &sysctl_sched_group_downmigrate_pct,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &sysctl_sched_group_upmigrate_pct,
},
{
.procname = "sched_ravg_window_nr_ticks",
.data = &sysctl_sched_ravg_window_nr_ticks,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
},
#endif /* CONFIG_PELT_COMPATIBILITY_LAYER */
{
.procname = "sched_child_runs_first",
.data = &sysctl_sched_child_runs_first,