sched: walt: fix smart fmax capping evaluation

Once load condition for fmax uncapping is satisfied, smart fmax
applies a hysteresis before re-applying the fmax cap after system
load goes down (i.e. system load should continuously remain below
the load threshold for hysteresis time).
Current hysteresis evaluation applies fmax capping before elapse of
hysteresis time, update the logic to honor capping hysteresis.

Change-Id: I34e18eb10f33f2d99a3dd5d9255011058f273ad8
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
This commit is contained in:
Ashay Jaiswal 2024-02-01 17:11:36 +05:30
parent cdd65ba050
commit 5e6f53ef97

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/syscore_ops.h>
@ -4607,7 +4607,6 @@ void fmax_uncap_checkpoint(int nr_big, u64 window_start, u32 wakeup_ctr_sum)
bool fmax_uncap_load_detected;
static u64 fmax_uncap_timestamp;
int i;
bool change = false;
fmax_uncap_load_detected = (nr_big >= 7 && wakeup_ctr_sum < WAKEUP_CTR_THRESH) ||
is_full_throttle_boost() ||
@ -4619,17 +4618,16 @@ void fmax_uncap_checkpoint(int nr_big, u64 window_start, u32 wakeup_ctr_sum)
for (i = 0; i < num_sched_clusters; i++)
fmax_cap[SMART_FMAX_CAP][i] = FREQ_QOS_MAX_DEFAULT_VALUE;
fmax_uncap_timestamp = window_start;
} else {
for (int i = 0; i < num_sched_clusters; i++) {
if (fmax_cap[SMART_FMAX_CAP][i] != sysctl_fmax_cap[i]) {
change = true;
break;
}
}
if (change || (fmax_uncap_timestamp &&
(window_start > fmax_uncap_timestamp + FMAX_CAP_HYSTERESIS))) {
} else if (fmax_uncap_timestamp) {
/*
* Enter to check for capping again only if we have already uncapped
* Apply fmax capping if we are continuously running at lower
* load for more than FMAX_CAP_HYSTERESIS.
*/
if (window_start > fmax_uncap_timestamp + FMAX_CAP_HYSTERESIS) {
for (int i = 0; i < num_sched_clusters; i++)
fmax_cap[SMART_FMAX_CAP][i] = sysctl_fmax_cap[i];
fmax_uncap_timestamp = 0;
}
}