sched: walt: move MVP task at front of mutex waiter
An mvp task might be waiting on a mutex that is being held by another task, and there are tasks waiting in the queue for the lock. This means that the mvp task may not get an opportunity to run as quickly as possible. Add support to move mvp task at the front of waiter queue, if mvp task is waiting for a mutex. Change-Id: I530f985ca08b140999eb5cda0888c1951da4102b Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com> Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
parent
278fdabf3e
commit
23f22d68b2
4 changed files with 47 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ KCOV_INSTRUMENT := n
|
|||
KCSAN_SANITIZE := n
|
||||
|
||||
obj-$(CONFIG_SCHED_WALT) += sched-walt.o
|
||||
sched-walt-$(CONFIG_SCHED_WALT) := walt.o boost.o sched_avg.o walt_halt.o core_ctl.o trace.o input-boost.o sysctl.o cpufreq_walt.o fixup.o walt_lb.o walt_rt.o walt_cfs.o walt_tp.o
|
||||
sched-walt-$(CONFIG_SCHED_WALT) := walt.o boost.o sched_avg.o walt_halt.o core_ctl.o trace.o input-boost.o sysctl.o cpufreq_walt.o fixup.o walt_lb.o walt_rt.o walt_cfs.o walt_tp.o mvp_locking.o
|
||||
|
||||
obj-$(CONFIG_SCHED_WALT_DEBUG) += sched-walt-debug.o
|
||||
sched-walt-debug-$(CONFIG_SCHED_WALT_DEBUG) := walt_debug.o preemptirq_long.o
|
||||
|
|
|
|||
44
kernel/sched/walt/mvp_locking.c
Normal file
44
kernel/sched/walt/mvp_locking.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <trace/hooks/dtask.h>
|
||||
#include "../../locking/mutex.h"
|
||||
#include "walt.h"
|
||||
|
||||
static void android_vh_alter_mutex_list_add(void *unused, struct mutex *lock,
|
||||
struct mutex_waiter *waiter, struct list_head *list,
|
||||
bool *already_on_list)
|
||||
{
|
||||
struct walt_task_struct *wts_waiter =
|
||||
(struct walt_task_struct *)current->android_vendor_data1;
|
||||
struct mutex_waiter *pos = NULL;
|
||||
struct mutex_waiter *n = NULL;
|
||||
struct list_head *head = list;
|
||||
struct walt_task_struct *wts;
|
||||
|
||||
if (unlikely(walt_disabled))
|
||||
return;
|
||||
|
||||
if (!lock || !waiter || !list)
|
||||
return;
|
||||
|
||||
if (!is_mvp(wts_waiter))
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(pos, n, head, list) {
|
||||
wts = (struct walt_task_struct *)
|
||||
((struct task_struct *)(pos->task)->android_vendor_data1);
|
||||
if (!is_mvp(wts)) {
|
||||
list_add(&waiter->list, pos->list.prev);
|
||||
*already_on_list = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void walt_mvp_lock_ordering_init(void)
|
||||
{
|
||||
register_trace_android_vh_alter_mutex_list_add(android_vh_alter_mutex_list_add, NULL);
|
||||
}
|
||||
|
|
@ -5450,6 +5450,7 @@ static void walt_init(struct work_struct *work)
|
|||
walt_rt_init();
|
||||
walt_cfs_init();
|
||||
walt_halt_init();
|
||||
walt_mvp_lock_ordering_init();
|
||||
|
||||
wait_for_completion_interruptible(&tick_sched_clock_completion);
|
||||
|
||||
|
|
|
|||
|
|
@ -879,6 +879,7 @@ extern void sched_update_hyst_times(void);
|
|||
extern void walt_rt_init(void);
|
||||
extern void walt_cfs_init(void);
|
||||
extern void walt_halt_init(void);
|
||||
extern void walt_mvp_lock_ordering_init(void);
|
||||
extern void walt_fixup_init(void);
|
||||
extern int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
|
||||
int sync, int sibling_count_hint);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue