sched: Add snapshot of core_ctl

This snapshot is taken from msm-4.14 as of commit 3206cd0e936a9f1
("sched: core_ctl: Add core_ctl_notifier_register()").

Change-Id: Icc082b55d620739e0e6be1c24e7506221cd5cfd9
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Satya Durga Srinivasu Prabhala
2018-11-14 09:50:44 -08:00
parent 5a28e00796
commit 07a16a8cc6
7 changed files with 1425 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ enum cpuhp_state {
CPUHP_SLAB_PREPARE, CPUHP_SLAB_PREPARE,
CPUHP_MD_RAID5_PREPARE, CPUHP_MD_RAID5_PREPARE,
CPUHP_RCUTREE_PREP, CPUHP_RCUTREE_PREP,
CPUHP_CORE_CTL_ISOLATION_DEAD,
CPUHP_CPUIDLE_COUPLED_PREPARE, CPUHP_CPUIDLE_COUPLED_PREPARE,
CPUHP_POWERPC_PMAC_PREPARE, CPUHP_POWERPC_PMAC_PREPARE,
CPUHP_POWERPC_MMU_CTX_PREPARE, CPUHP_POWERPC_MMU_CTX_PREPARE,

View File

@@ -951,6 +951,96 @@ TRACE_EVENT(sched_boost_cpu,
__entry->margin) __entry->margin)
); );
TRACE_EVENT(core_ctl_eval_need,
TP_PROTO(unsigned int cpu, unsigned int old_need,
unsigned int new_need, unsigned int updated),
TP_ARGS(cpu, old_need, new_need, updated),
TP_STRUCT__entry(
__field(u32, cpu)
__field(u32, old_need)
__field(u32, new_need)
__field(u32, updated)
),
TP_fast_assign(
__entry->cpu = cpu;
__entry->old_need = old_need;
__entry->new_need = new_need;
__entry->updated = updated;
),
TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu,
__entry->old_need, __entry->new_need, __entry->updated)
);
TRACE_EVENT(core_ctl_set_busy,
TP_PROTO(unsigned int cpu, unsigned int busy,
unsigned int old_is_busy, unsigned int is_busy),
TP_ARGS(cpu, busy, old_is_busy, is_busy),
TP_STRUCT__entry(
__field(u32, cpu)
__field(u32, busy)
__field(u32, old_is_busy)
__field(u32, is_busy)
__field(bool, high_irqload)
),
TP_fast_assign(
__entry->cpu = cpu;
__entry->busy = busy;
__entry->old_is_busy = old_is_busy;
__entry->is_busy = is_busy;
__entry->high_irqload = sched_cpu_high_irqload(cpu);
),
TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u high_irqload=%d",
__entry->cpu, __entry->busy, __entry->old_is_busy,
__entry->is_busy, __entry->high_irqload)
);
TRACE_EVENT(core_ctl_set_boost,
TP_PROTO(u32 refcount, s32 ret),
TP_ARGS(refcount, ret),
TP_STRUCT__entry(
__field(u32, refcount)
__field(s32, ret)
),
TP_fast_assign(
__entry->refcount = refcount;
__entry->ret = ret;
),
TP_printk("refcount=%u, ret=%d", __entry->refcount, __entry->ret)
);
TRACE_EVENT(core_ctl_update_nr_need,
TP_PROTO(int cpu, int nr_need, int prev_misfit_need,
int nrrun, int max_nr, int nr_prev_assist),
TP_ARGS(cpu, nr_need, prev_misfit_need, nrrun, max_nr, nr_prev_assist),
TP_STRUCT__entry(
__field(int, cpu)
__field(int, nr_need)
__field(int, prev_misfit_need)
__field(int, nrrun)
__field(int, max_nr)
__field(int, nr_prev_assist)
),
TP_fast_assign(
__entry->cpu = cpu;
__entry->nr_need = nr_need;
__entry->prev_misfit_need = prev_misfit_need;
__entry->nrrun = nrrun;
__entry->max_nr = max_nr;
__entry->nr_prev_assist = nr_prev_assist;
),
TP_printk("cpu=%d nr_need=%d prev_misfit_need=%d nrrun=%d max_nr=%d nr_prev_assist=%d",
__entry->cpu, __entry->nr_need, __entry->prev_misfit_need,
__entry->nrrun, __entry->max_nr, __entry->nr_prev_assist)
);
/* /*
* Tracepoint for schedtune_tasks_update * Tracepoint for schedtune_tasks_update
*/ */

View File

@@ -932,6 +932,16 @@ config SOCK_CGROUP_DATA
endif # CGROUPS endif # CGROUPS
config SCHED_CORE_CTL
bool "QTI Core Control"
depends on SMP
help
This options enables the core control functionality in
the scheduler. Core control automatically offline and
online cores based on cpu load and utilization.
If unsure, say N here.
menuconfig NAMESPACES menuconfig NAMESPACES
bool "Namespaces support" if EXPERT bool "Namespaces support" if EXPERT
depends on MULTIUSER depends on MULTIUSER

View File

@@ -30,3 +30,4 @@ obj-$(CONFIG_CPU_FREQ) += cpufreq.o
obj-$(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) += cpufreq_schedutil.o obj-$(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) += cpufreq_schedutil.o
obj-$(CONFIG_MEMBARRIER) += membarrier.o obj-$(CONFIG_MEMBARRIER) += membarrier.o
obj-$(CONFIG_CPU_ISOLATION) += isolation.o obj-$(CONFIG_CPU_ISOLATION) += isolation.o
obj-$(CONFIG_SCHED_CORE_CTL) += core_ctl.o

View File

@@ -20,6 +20,7 @@
#include "pelt.h" #include "pelt.h"
#include "walt.h" #include "walt.h"
#include "core_ctl.h"
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/sched.h> #include <trace/events/sched.h>
@@ -3178,6 +3179,8 @@ void scheduler_tick(void)
if (curr->sched_class == &fair_sched_class) if (curr->sched_class == &fair_sched_class)
check_for_migration(rq, curr); check_for_migration(rq, curr);
core_ctl_check(wallclock);
} }
#ifdef CONFIG_NO_HZ_FULL #ifdef CONFIG_NO_HZ_FULL

1301
kernel/sched/core_ctl.c Normal file

File diff suppressed because it is too large Load Diff

19
kernel/sched/core_ctl.h Normal file
View File

@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
*/
#ifndef __CORE_CTL_H
#define __CORE_CTL_H
#ifdef CONFIG_SCHED_CORE_CTL
void core_ctl_check(u64 wallclock);
int core_ctl_set_boost(bool boost);
#else
static inline void core_ctl_check(u64 wallclock) {}
static inline int core_ctl_set_boost(bool boost)
{
return 0;
}
#endif
#endif