Revert "sched: Improve the scheduler"

This reverts commit a3dd94a1bb.

Bug:133481659
Test: build
Change-Id: Ib23609315f3446223521612621fe54469537c172
Signed-off-by: Wei Wang <wvw@google.com>
urubino
Wei Wang 5 years ago committed by Jenna-they-them
parent b774dc967f
commit 7b28fe9667
  1. 32
      drivers/cpufreq/cpufreq.c
  2. 3
      drivers/cpufreq/freq_table.c
  3. 2
      include/linux/cpufreq.h
  4. 2
      include/linux/sched/sysctl.h
  5. 2
      kernel/compat.c
  6. 18
      kernel/sched/core.c
  7. 9
      kernel/sysctl.c

@ -32,6 +32,7 @@
#include <linux/tick.h>
#include <linux/sched/topology.h>
#include <linux/sched/sysctl.h>
#include <linux/ologk.h>
#include <trace/events/power.h>
@ -660,40 +661,11 @@ static ssize_t show_##file_name \
}
show_one(cpuinfo_min_freq, cpuinfo.min_freq);
show_one(cpuinfo_max_freq, cpuinfo.max_freq);
show_one(cpuinfo_transition_latency, cpuinfo.transition_latency);
show_one(scaling_min_freq, min);
show_one(scaling_max_freq, max);
unsigned int cpuinfo_max_freq_cached;
static bool should_use_cached_freq(int cpu)
{
/* This is a safe check. may not be needed */
if (!cpuinfo_max_freq_cached)
return false;
/*
* perfd already configure sched_lib_mask_force to
* 0xf0 from user space. so re-using it.
*/
if (!(BIT(cpu) & sched_lib_mask_force))
return false;
return is_sched_lib_based_app(current->pid);
}
static ssize_t show_cpuinfo_max_freq(struct cpufreq_policy *policy, char *buf)
{
unsigned int freq = policy->cpuinfo.max_freq;
if (should_use_cached_freq(policy->cpu))
freq = cpuinfo_max_freq_cached << 1;
else
freq = policy->cpuinfo.max_freq;
return scnprintf(buf, PAGE_SIZE, "%u\n", freq);
}
__weak unsigned int arch_freq_get_on_cpu(int cpu)
{
return 0;

@ -62,9 +62,6 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
policy->min = policy->cpuinfo.min_freq = min_freq;
policy->max = policy->cpuinfo.max_freq = max_freq;
if (max_freq > cpuinfo_max_freq_cached)
cpuinfo_max_freq_cached = max_freq;
if (policy->min == ~0)
return -EINVAL;
else

@ -957,6 +957,4 @@ unsigned int cpufreq_generic_get(unsigned int cpu);
int cpufreq_generic_init(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table,
unsigned int transition_latency);
extern unsigned int cpuinfo_max_freq_cached;
#endif /* _LINUX_CPUFREQ_H */

@ -136,7 +136,7 @@ extern int sched_little_cluster_coloc_fmin_khz_handler(struct ctl_table *table,
#define LIB_PATH_LENGTH 512
extern char sched_lib_name[LIB_PATH_LENGTH];
extern unsigned int sched_lib_mask_check;
extern unsigned int sched_lib_mask_force;
extern bool is_sched_lib_based_app(pid_t pid);
#endif /* _LINUX_SCHED_SYSCTL_H */

@ -334,7 +334,7 @@ COMPAT_SYSCALL_DEFINE3(sched_setaffinity, compat_pid_t, pid,
if (retval)
goto out;
retval = sched_setaffinity(pid, new_mask);
retval = msm_sched_setaffinity(pid, new_mask);
out:
free_cpumask_var(new_mask);
return retval;

@ -4932,8 +4932,9 @@ out_put_task:
}
char sched_lib_name[LIB_PATH_LENGTH];
unsigned int sched_lib_mask_check;
unsigned int sched_lib_mask_force;
bool is_sched_lib_based_app(pid_t pid)
static inline bool is_sched_lib_based_app(pid_t pid)
{
const char *name = NULL;
struct vm_area_struct *vma;
@ -4985,6 +4986,19 @@ put_task_struct:
return found;
}
long msm_sched_setaffinity(pid_t pid, struct cpumask *new_mask)
{
if (sched_lib_mask_check != 0 && sched_lib_mask_force != 0 &&
(cpumask_bits(new_mask)[0] == sched_lib_mask_check) &&
is_sched_lib_based_app(pid)) {
cpumask_t forced_mask = { {sched_lib_mask_force} };
cpumask_copy(new_mask, &forced_mask);
}
return sched_setaffinity(pid, new_mask);
}
static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
struct cpumask *new_mask)
{
@ -5015,7 +5029,7 @@ SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
retval = get_user_cpu_mask(user_mask_ptr, len, new_mask);
if (retval == 0)
retval = sched_setaffinity(pid, new_mask);
retval = msm_sched_setaffinity(pid, new_mask);
free_cpumask_var(new_mask);
return retval;
}

@ -644,6 +644,15 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dostring,
},
{
.procname = "sched_lib_mask_check",
.data = &sched_lib_mask_check,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_douintvec_minmax,
.extra1 = &zero,
.extra2 = &two_hundred_fifty_five,
},
{
.procname = "sched_lib_mask_force",
.data = &sched_lib_mask_force,

Loading…
Cancel
Save