sched: add per CPU sched_load_boost knob

Commit '858d5751bcf7b6a ("sched: introduce per CPU sched_load_boost
knob")' introduce a new knob sched_load_boost that allows userspace to
provide additional CPU capacity margin to work running on CPUs in
msm-4.9. Userspace could increase this for exceedingly sporadic workloads
in case the existing margin isn't sufficient.

While porting it, sched_load_boost support is ported but missed adding
procfs interface. Add it now to let user space configure the knob.

Change-Id: I4277c63089f6bb5227d257ab7484d50c42827c86
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
tirimbino
Lingutla Chandrasekhar 7 years ago committed by Gerrit - the friendly Code Review server
parent e9525c9720
commit 93ec43e66c
  1. 55
      drivers/base/cpu.c

@ -209,6 +209,59 @@ static struct attribute_group cpu_isolated_attr_group = {
#endif
static ssize_t show_sched_load_boost(struct device *dev,
struct device_attribute *attr, char *buf)
{
ssize_t rc;
unsigned int boost;
struct cpu *cpu = container_of(dev, struct cpu, dev);
int cpuid = cpu->dev.id;
boost = per_cpu(sched_load_boost, cpuid);
rc = snprintf(buf, PAGE_SIZE-2, "%d\n", boost);
return rc;
}
static ssize_t __ref store_sched_load_boost(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int err;
int boost;
struct cpu *cpu = container_of(dev, struct cpu, dev);
int cpuid = cpu->dev.id;
err = kstrtoint(strstrip((char *)buf), 0, &boost);
if (err)
return err;
/*
* -100 is low enough to cancel out CPU's load and make it near zro.
* 1000 is close to the maximum value that cpu_util_freq_{walt,pelt}
* can take without overflow.
*/
if (boost < -100 || boost > 1000)
return -EINVAL;
per_cpu(sched_load_boost, cpuid) = boost;
return count;
}
static DEVICE_ATTR(sched_load_boost, 0644,
show_sched_load_boost,
store_sched_load_boost);
static struct attribute *sched_cpu_attrs[] = {
&dev_attr_sched_load_boost.attr,
NULL
};
static struct attribute_group sched_cpu_attr_group = {
.attrs = sched_cpu_attrs,
};
static const struct attribute_group *common_cpu_attr_groups[] = {
#ifdef CONFIG_KEXEC
&crash_note_cpu_attr_group,
@ -216,6 +269,7 @@ static const struct attribute_group *common_cpu_attr_groups[] = {
#ifdef CONFIG_HOTPLUG_CPU
&cpu_isolated_attr_group,
#endif
&sched_cpu_attr_group,
NULL
};
@ -226,6 +280,7 @@ static const struct attribute_group *hotplugable_cpu_attr_groups[] = {
#ifdef CONFIG_HOTPLUG_CPU
&cpu_isolated_attr_group,
#endif
&sched_cpu_attr_group,
NULL
};

Loading…
Cancel
Save