mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
isolcpus: don't select isolate cpu for non-bind tasks. [1/1]
PD#SWPL-151292 Problem: Some tasks have been running in apu before isolating cpu. Solution: when tasks were scheduled,if tasks shouldn't be run on the apu, they will be migrated to other cpus. Verify: T5M Change-Id: I97a91f1a40425a3ab26801de9a6bcb4b19c33019 Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
This commit is contained in:
committed by
gerrit autosubmit
parent
6443766f46
commit
318edc8359
@@ -59,3 +59,8 @@
|
||||
sprint_symbol_no_offset
|
||||
task_sched_runtime
|
||||
bpf_trace_run9
|
||||
|
||||
# amlogic_debug.ko
|
||||
__tracepoint_android_rvh_select_task_rq_fair
|
||||
__traceiter_android_rvh_select_task_rq_fair
|
||||
|
||||
|
||||
@@ -12,12 +12,15 @@
|
||||
#include <linux/cpuset.h>
|
||||
#include <linux/sched/isolation.h>
|
||||
#include <linux/amlogic/gki_module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <trace/hooks/sched.h>
|
||||
|
||||
static int have_isolcpus;
|
||||
static int have_aml_isolcpus;
|
||||
static int have_isolcpus_speedup_boot;
|
||||
static struct cpumask aml_house_keeping_mask;
|
||||
static int isolcpus_speedup_boot;
|
||||
static struct cpumask isolcpus_mask;
|
||||
|
||||
#ifdef CONFIG_ARM64
|
||||
#define REG_0 regs->regs[0]
|
||||
@@ -66,7 +69,6 @@ __setup("isolcpus=", isolcpus_setup);
|
||||
|
||||
static int aml_isolcpus_setup(char *str)
|
||||
{
|
||||
struct cpumask isolcpus_mask;
|
||||
|
||||
have_aml_isolcpus = 1;
|
||||
if (cpulist_parse(str, &isolcpus_mask) < 0) {
|
||||
@@ -81,6 +83,8 @@ static int aml_isolcpus_setup(char *str)
|
||||
}
|
||||
__setup("aml_isolcpus=", aml_isolcpus_setup);
|
||||
|
||||
extern void rebuild_sched_flag(void);
|
||||
|
||||
static int isolcpus_speedup_boot_set(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
int n = 0, ret;
|
||||
@@ -95,6 +99,7 @@ static int isolcpus_speedup_boot_set(const char *val, const struct kernel_param
|
||||
//pr_info("isolcpus_speedup_boot=%d\n", isolcpus_speedup_boot);
|
||||
|
||||
rebuild_sched_domains();
|
||||
rebuild_sched_flag();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -118,6 +123,17 @@ static int isolcpus_speedup_boot_setup(char *str)
|
||||
}
|
||||
__setup("isolcpus_speedup_boot=", isolcpus_speedup_boot_setup);
|
||||
|
||||
#ifdef CONFIG_ANDROID_VENDOR_HOOKS
|
||||
static void select_task_rq_hook(void *data, struct task_struct *p, int prev_cpu, int sd_flag,
|
||||
int wake_flags, int *new_cpu)
|
||||
{
|
||||
if (!isolcpus_speedup_boot && cpumask_test_cpu(prev_cpu, &isolcpus_mask) &&
|
||||
!cpumask_equal((const struct cpumask *)&isolcpus_mask,
|
||||
(const struct cpumask *)&p->cpus_mask))
|
||||
*new_cpu = cpumask_last(&aml_house_keeping_mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
int aml_isolcpus_init(void)
|
||||
{
|
||||
int ret;
|
||||
@@ -144,8 +160,15 @@ int aml_isolcpus_init(void)
|
||||
}
|
||||
|
||||
//if need do really isolcpus, so rebuild domains
|
||||
if (!isolcpus_speedup_boot)
|
||||
if (!isolcpus_speedup_boot) {
|
||||
rebuild_sched_domains();
|
||||
rebuild_sched_flag();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ANDROID_VENDOR_HOOKS
|
||||
register_trace_android_rvh_select_task_rq_fair(select_task_rq_hook, NULL);
|
||||
register_trace_android_rvh_select_task_rq_rt(select_task_rq_hook, NULL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+15
-10
@@ -590,11 +590,24 @@ static void tick_entry_hook(void *data, struct rq *rq)
|
||||
}
|
||||
#endif
|
||||
|
||||
int aml_sched_init(void)
|
||||
void rebuild_sched_flag(void)
|
||||
{
|
||||
int cpu, old_flags;
|
||||
struct sched_domain *sd;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
for_each_domain(cpu, sd) {
|
||||
old_flags = sd->flags;
|
||||
sd->flags &= ~SD_WAKE_AFFINE;
|
||||
sd->flags |= (SD_BALANCE_WAKE | SD_BALANCE_NEWIDLE);
|
||||
pr_info("cpu:%d sd:%px flags:%x->%x\n", cpu, sd, old_flags, sd->flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(rebuild_sched_flag);
|
||||
|
||||
int aml_sched_init(void)
|
||||
{
|
||||
#if defined(CONFIG_ANDROID_VENDOR_HOOKS) && defined(CONFIG_FAIR_GROUP_SCHED)
|
||||
register_trace_android_rvh_select_task_rq_rt(aml_select_rt_nice, NULL);
|
||||
register_trace_android_rvh_check_preempt_wakeup(aml_check_preempt_wakeup, NULL);
|
||||
@@ -609,15 +622,7 @@ int aml_sched_init(void)
|
||||
register_trace_android_rvh_tick_entry(tick_entry_hook, NULL);
|
||||
register_trace_android_vh_sched_show_task(sched_show_task_hook, NULL);
|
||||
#endif
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
for_each_domain(cpu, sd) {
|
||||
old_flags = sd->flags;
|
||||
sd->flags &= ~SD_WAKE_AFFINE;
|
||||
sd->flags |= (SD_BALANCE_WAKE | SD_BALANCE_NEWIDLE);
|
||||
pr_info("cpu:%d sd:%px flags:%x->%x\n", cpu, sd, old_flags, sd->flags);
|
||||
}
|
||||
}
|
||||
rebuild_sched_flag();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user