aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4dbfd04a2148..df00cb09263e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4330,7 +4330,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
4330 goto out_free_cpus_allowed; 4330 goto out_free_cpus_allowed;
4331 } 4331 }
4332 retval = -EPERM; 4332 retval = -EPERM;
4333 if (!check_same_owner(p) && !task_ns_capable(p, CAP_SYS_NICE)) 4333 if (!check_same_owner(p) && !ns_capable(task_user_ns(p), CAP_SYS_NICE))
4334 goto out_unlock; 4334 goto out_unlock;
4335 4335
4336 retval = security_task_setscheduler(p); 4336 retval = security_task_setscheduler(p);
@@ -5176,7 +5176,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep)
5176static void 5176static void
5177set_table_entry(struct ctl_table *entry, 5177set_table_entry(struct ctl_table *entry,
5178 const char *procname, void *data, int maxlen, 5178 const char *procname, void *data, int maxlen,
5179 mode_t mode, proc_handler *proc_handler) 5179 umode_t mode, proc_handler *proc_handler)
5180{ 5180{
5181 entry->procname = procname; 5181 entry->procname = procname;
5182 entry->data = data; 5182 entry->data = data;
@@ -6675,54 +6675,52 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
6675} 6675}
6676 6676
6677#ifdef CONFIG_SCHED_MC 6677#ifdef CONFIG_SCHED_MC
6678static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, 6678static ssize_t sched_mc_power_savings_show(struct device *dev,
6679 struct sysdev_class_attribute *attr, 6679 struct device_attribute *attr,
6680 char *page) 6680 char *buf)
6681{ 6681{
6682 return sprintf(page, "%u\n", sched_mc_power_savings); 6682 return sprintf(buf, "%u\n", sched_mc_power_savings);
6683} 6683}
6684static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, 6684static ssize_t sched_mc_power_savings_store(struct device *dev,
6685 struct sysdev_class_attribute *attr, 6685 struct device_attribute *attr,
6686 const char *buf, size_t count) 6686 const char *buf, size_t count)
6687{ 6687{
6688 return sched_power_savings_store(buf, count, 0); 6688 return sched_power_savings_store(buf, count, 0);
6689} 6689}
6690static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, 6690static DEVICE_ATTR(sched_mc_power_savings, 0644,
6691 sched_mc_power_savings_show, 6691 sched_mc_power_savings_show,
6692 sched_mc_power_savings_store); 6692 sched_mc_power_savings_store);
6693#endif 6693#endif
6694 6694
6695#ifdef CONFIG_SCHED_SMT 6695#ifdef CONFIG_SCHED_SMT
6696static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, 6696static ssize_t sched_smt_power_savings_show(struct device *dev,
6697 struct sysdev_class_attribute *attr, 6697 struct device_attribute *attr,
6698 char *page) 6698 char *buf)
6699{ 6699{
6700 return sprintf(page, "%u\n", sched_smt_power_savings); 6700 return sprintf(buf, "%u\n", sched_smt_power_savings);
6701} 6701}
6702static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, 6702static ssize_t sched_smt_power_savings_store(struct device *dev,
6703 struct sysdev_class_attribute *attr, 6703 struct device_attribute *attr,
6704 const char *buf, size_t count) 6704 const char *buf, size_t count)
6705{ 6705{
6706 return sched_power_savings_store(buf, count, 1); 6706 return sched_power_savings_store(buf, count, 1);
6707} 6707}
6708static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644, 6708static DEVICE_ATTR(sched_smt_power_savings, 0644,
6709 sched_smt_power_savings_show, 6709 sched_smt_power_savings_show,
6710 sched_smt_power_savings_store); 6710 sched_smt_power_savings_store);
6711#endif 6711#endif
6712 6712
6713int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls) 6713int __init sched_create_sysfs_power_savings_entries(struct device *dev)
6714{ 6714{
6715 int err = 0; 6715 int err = 0;
6716 6716
6717#ifdef CONFIG_SCHED_SMT 6717#ifdef CONFIG_SCHED_SMT
6718 if (smt_capable()) 6718 if (smt_capable())
6719 err = sysfs_create_file(&cls->kset.kobj, 6719 err = device_create_file(dev, &dev_attr_sched_smt_power_savings);
6720 &attr_sched_smt_power_savings.attr);
6721#endif 6720#endif
6722#ifdef CONFIG_SCHED_MC 6721#ifdef CONFIG_SCHED_MC
6723 if (!err && mc_capable()) 6722 if (!err && mc_capable())
6724 err = sysfs_create_file(&cls->kset.kobj, 6723 err = device_create_file(dev, &dev_attr_sched_mc_power_savings);
6725 &attr_sched_mc_power_savings.attr);
6726#endif 6724#endif
6727 return err; 6725 return err;
6728} 6726}
@@ -7136,10 +7134,6 @@ void set_curr_task(int cpu, struct task_struct *p)
7136 7134
7137#endif 7135#endif
7138 7136
7139#ifdef CONFIG_RT_GROUP_SCHED
7140#else /* !CONFIG_RT_GROUP_SCHED */
7141#endif /* CONFIG_RT_GROUP_SCHED */
7142
7143#ifdef CONFIG_CGROUP_SCHED 7137#ifdef CONFIG_CGROUP_SCHED
7144/* task_group_lock serializes the addition/removal of task groups */ 7138/* task_group_lock serializes the addition/removal of task groups */
7145static DEFINE_SPINLOCK(task_group_lock); 7139static DEFINE_SPINLOCK(task_group_lock);
@@ -7248,9 +7242,6 @@ void sched_move_task(struct task_struct *tsk)
7248} 7242}
7249#endif /* CONFIG_CGROUP_SCHED */ 7243#endif /* CONFIG_CGROUP_SCHED */
7250 7244
7251#ifdef CONFIG_FAIR_GROUP_SCHED
7252#endif
7253
7254#if defined(CONFIG_RT_GROUP_SCHED) || defined(CONFIG_CFS_BANDWIDTH) 7245#if defined(CONFIG_RT_GROUP_SCHED) || defined(CONFIG_CFS_BANDWIDTH)
7255static unsigned long to_ratio(u64 period, u64 runtime) 7246static unsigned long to_ratio(u64 period, u64 runtime)
7256{ 7247{
@@ -7565,24 +7556,31 @@ cpu_cgroup_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp)
7565 sched_destroy_group(tg); 7556 sched_destroy_group(tg);
7566} 7557}
7567 7558
7568static int 7559static int cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
7569cpu_cgroup_can_attach_task(struct cgroup *cgrp, struct task_struct *tsk) 7560 struct cgroup_taskset *tset)
7570{ 7561{
7562 struct task_struct *task;
7563
7564 cgroup_taskset_for_each(task, cgrp, tset) {
7571#ifdef CONFIG_RT_GROUP_SCHED 7565#ifdef CONFIG_RT_GROUP_SCHED
7572 if (!sched_rt_can_attach(cgroup_tg(cgrp), tsk)) 7566 if (!sched_rt_can_attach(cgroup_tg(cgrp), task))
7573 return -EINVAL; 7567 return -EINVAL;
7574#else 7568#else
7575 /* We don't support RT-tasks being in separate groups */ 7569 /* We don't support RT-tasks being in separate groups */
7576 if (tsk->sched_class != &fair_sched_class) 7570 if (task->sched_class != &fair_sched_class)
7577 return -EINVAL; 7571 return -EINVAL;
7578#endif 7572#endif
7573 }
7579 return 0; 7574 return 0;
7580} 7575}
7581 7576
7582static void 7577static void cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
7583cpu_cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) 7578 struct cgroup_taskset *tset)
7584{ 7579{
7585 sched_move_task(tsk); 7580 struct task_struct *task;
7581
7582 cgroup_taskset_for_each(task, cgrp, tset)
7583 sched_move_task(task);
7586} 7584}
7587 7585
7588static void 7586static void
@@ -7917,8 +7915,8 @@ struct cgroup_subsys cpu_cgroup_subsys = {
7917 .name = "cpu", 7915 .name = "cpu",
7918 .create = cpu_cgroup_create, 7916 .create = cpu_cgroup_create,
7919 .destroy = cpu_cgroup_destroy, 7917 .destroy = cpu_cgroup_destroy,
7920 .can_attach_task = cpu_cgroup_can_attach_task, 7918 .can_attach = cpu_cgroup_can_attach,
7921 .attach_task = cpu_cgroup_attach_task, 7919 .attach = cpu_cgroup_attach,
7922 .exit = cpu_cgroup_exit, 7920 .exit = cpu_cgroup_exit,
7923 .populate = cpu_cgroup_populate, 7921 .populate = cpu_cgroup_populate,
7924 .subsys_id = cpu_cgroup_subsys_id, 7922 .subsys_id = cpu_cgroup_subsys_id,