aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-02 14:02:55 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 14:03:08 -0400
commitc9494727cf293ae2ec66af57547a3e79c724fec2 (patch)
tree44ae197b64fa7530ee695a90ad31326dda06f1e1 /kernel/sched.c
parent6427462bfa50f50dc6c088c07037264fcc73eca1 (diff)
parent42be79e37e264557f12860fa4cc84b4de3685954 (diff)
Merge branch 'linus' into sched/core
Merge reason: update to latest upstream Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index cc6dc8caa380..52b7efd27416 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1543,7 +1543,7 @@ static unsigned long cpu_avg_load_per_task(int cpu)
1543 1543
1544#ifdef CONFIG_FAIR_GROUP_SCHED 1544#ifdef CONFIG_FAIR_GROUP_SCHED
1545 1545
1546static __read_mostly unsigned long *update_shares_data; 1546static __read_mostly unsigned long __percpu *update_shares_data;
1547 1547
1548static void __set_se_shares(struct sched_entity *se, unsigned long shares); 1548static void __set_se_shares(struct sched_entity *se, unsigned long shares);
1549 1549
@@ -2604,7 +2604,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
2604{ 2604{
2605 unsigned long flags; 2605 unsigned long flags;
2606 struct rq *rq; 2606 struct rq *rq;
2607 int cpu = get_cpu(); 2607 int cpu __maybe_unused = get_cpu();
2608 2608
2609#ifdef CONFIG_SMP 2609#ifdef CONFIG_SMP
2610 /* 2610 /*
@@ -4289,7 +4289,7 @@ int can_nice(const struct task_struct *p, const int nice)
4289 /* convert nice value [19,-20] to rlimit style value [1,40] */ 4289 /* convert nice value [19,-20] to rlimit style value [1,40] */
4290 int nice_rlim = 20 - nice; 4290 int nice_rlim = 20 - nice;
4291 4291
4292 return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur || 4292 return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
4293 capable(CAP_SYS_NICE)); 4293 capable(CAP_SYS_NICE));
4294} 4294}
4295 4295
@@ -4466,7 +4466,7 @@ recheck:
4466 4466
4467 if (!lock_task_sighand(p, &flags)) 4467 if (!lock_task_sighand(p, &flags))
4468 return -ESRCH; 4468 return -ESRCH;
4469 rlim_rtprio = p->signal->rlim[RLIMIT_RTPRIO].rlim_cur; 4469 rlim_rtprio = task_rlimit(p, RLIMIT_RTPRIO);
4470 unlock_task_sighand(p, &flags); 4470 unlock_task_sighand(p, &flags);
4471 4471
4472 /* can't set/change the rt policy */ 4472 /* can't set/change the rt policy */
@@ -4837,7 +4837,9 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
4837 int ret; 4837 int ret;
4838 cpumask_var_t mask; 4838 cpumask_var_t mask;
4839 4839
4840 if (len < cpumask_size()) 4840 if (len < nr_cpu_ids)
4841 return -EINVAL;
4842 if (len & (sizeof(unsigned long)-1))
4841 return -EINVAL; 4843 return -EINVAL;
4842 4844
4843 if (!alloc_cpumask_var(&mask, GFP_KERNEL)) 4845 if (!alloc_cpumask_var(&mask, GFP_KERNEL))
@@ -4845,10 +4847,12 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
4845 4847
4846 ret = sched_getaffinity(pid, mask); 4848 ret = sched_getaffinity(pid, mask);
4847 if (ret == 0) { 4849 if (ret == 0) {
4848 if (copy_to_user(user_mask_ptr, mask, cpumask_size())) 4850 size_t retlen = min_t(size_t, len, cpumask_size());
4851
4852 if (copy_to_user(user_mask_ptr, mask, retlen))
4849 ret = -EFAULT; 4853 ret = -EFAULT;
4850 else 4854 else
4851 ret = cpumask_size(); 4855 ret = retlen;
4852 } 4856 }
4853 free_cpumask_var(mask); 4857 free_cpumask_var(mask);
4854 4858
@@ -7338,11 +7342,13 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
7338 7342
7339#ifdef CONFIG_SCHED_MC 7343#ifdef CONFIG_SCHED_MC
7340static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, 7344static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
7345 struct sysdev_class_attribute *attr,
7341 char *page) 7346 char *page)
7342{ 7347{
7343 return sprintf(page, "%u\n", sched_mc_power_savings); 7348 return sprintf(page, "%u\n", sched_mc_power_savings);
7344} 7349}
7345static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, 7350static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
7351 struct sysdev_class_attribute *attr,
7346 const char *buf, size_t count) 7352 const char *buf, size_t count)
7347{ 7353{
7348 return sched_power_savings_store(buf, count, 0); 7354 return sched_power_savings_store(buf, count, 0);
@@ -7354,11 +7360,13 @@ static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
7354 7360
7355#ifdef CONFIG_SCHED_SMT 7361#ifdef CONFIG_SCHED_SMT
7356static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, 7362static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
7363 struct sysdev_class_attribute *attr,
7357 char *page) 7364 char *page)
7358{ 7365{
7359 return sprintf(page, "%u\n", sched_smt_power_savings); 7366 return sprintf(page, "%u\n", sched_smt_power_savings);
7360} 7367}
7361static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, 7368static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
7369 struct sysdev_class_attribute *attr,
7362 const char *buf, size_t count) 7370 const char *buf, size_t count)
7363{ 7371{
7364 return sched_power_savings_store(buf, count, 1); 7372 return sched_power_savings_store(buf, count, 1);
@@ -8742,7 +8750,7 @@ struct cgroup_subsys cpu_cgroup_subsys = {
8742struct cpuacct { 8750struct cpuacct {
8743 struct cgroup_subsys_state css; 8751 struct cgroup_subsys_state css;
8744 /* cpuusage holds pointer to a u64-type object on every cpu */ 8752 /* cpuusage holds pointer to a u64-type object on every cpu */
8745 u64 *cpuusage; 8753 u64 __percpu *cpuusage;
8746 struct percpu_counter cpustat[CPUACCT_STAT_NSTATS]; 8754 struct percpu_counter cpustat[CPUACCT_STAT_NSTATS];
8747 struct cpuacct *parent; 8755 struct cpuacct *parent;
8748}; 8756};