diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 68 |
1 files changed, 17 insertions, 51 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 740fb409e5bb..34bcc5bc120e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -8025,7 +8025,7 @@ static void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, | |||
8025 | 8025 | ||
8026 | se->my_q = cfs_rq; | 8026 | se->my_q = cfs_rq; |
8027 | se->load.weight = tg->shares; | 8027 | se->load.weight = tg->shares; |
8028 | se->load.inv_weight = div64_64(1ULL<<32, se->load.weight); | 8028 | se->load.inv_weight = div64_u64(1ULL<<32, se->load.weight); |
8029 | se->parent = parent; | 8029 | se->parent = parent; |
8030 | } | 8030 | } |
8031 | #endif | 8031 | #endif |
@@ -8692,7 +8692,7 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares) | |||
8692 | dequeue_entity(cfs_rq, se, 0); | 8692 | dequeue_entity(cfs_rq, se, 0); |
8693 | 8693 | ||
8694 | se->load.weight = shares; | 8694 | se->load.weight = shares; |
8695 | se->load.inv_weight = div64_64((1ULL<<32), shares); | 8695 | se->load.inv_weight = div64_u64((1ULL<<32), shares); |
8696 | 8696 | ||
8697 | if (on_rq) | 8697 | if (on_rq) |
8698 | enqueue_entity(cfs_rq, se, 0); | 8698 | enqueue_entity(cfs_rq, se, 0); |
@@ -8787,7 +8787,7 @@ static unsigned long to_ratio(u64 period, u64 runtime) | |||
8787 | if (runtime == RUNTIME_INF) | 8787 | if (runtime == RUNTIME_INF) |
8788 | return 1ULL << 16; | 8788 | return 1ULL << 16; |
8789 | 8789 | ||
8790 | return div64_64(runtime << 16, period); | 8790 | return div64_u64(runtime << 16, period); |
8791 | } | 8791 | } |
8792 | 8792 | ||
8793 | #ifdef CONFIG_CGROUP_SCHED | 8793 | #ifdef CONFIG_CGROUP_SCHED |
@@ -9057,13 +9057,13 @@ cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | |||
9057 | } | 9057 | } |
9058 | 9058 | ||
9059 | #ifdef CONFIG_FAIR_GROUP_SCHED | 9059 | #ifdef CONFIG_FAIR_GROUP_SCHED |
9060 | static int cpu_shares_write_uint(struct cgroup *cgrp, struct cftype *cftype, | 9060 | static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype, |
9061 | u64 shareval) | 9061 | u64 shareval) |
9062 | { | 9062 | { |
9063 | return sched_group_set_shares(cgroup_tg(cgrp), shareval); | 9063 | return sched_group_set_shares(cgroup_tg(cgrp), shareval); |
9064 | } | 9064 | } |
9065 | 9065 | ||
9066 | static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft) | 9066 | static u64 cpu_shares_read_u64(struct cgroup *cgrp, struct cftype *cft) |
9067 | { | 9067 | { |
9068 | struct task_group *tg = cgroup_tg(cgrp); | 9068 | struct task_group *tg = cgroup_tg(cgrp); |
9069 | 9069 | ||
@@ -9073,48 +9073,14 @@ static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft) | |||
9073 | 9073 | ||
9074 | #ifdef CONFIG_RT_GROUP_SCHED | 9074 | #ifdef CONFIG_RT_GROUP_SCHED |
9075 | static ssize_t cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft, | 9075 | static ssize_t cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft, |
9076 | struct file *file, | 9076 | s64 val) |
9077 | const char __user *userbuf, | ||
9078 | size_t nbytes, loff_t *unused_ppos) | ||
9079 | { | 9077 | { |
9080 | char buffer[64]; | 9078 | return sched_group_set_rt_runtime(cgroup_tg(cgrp), val); |
9081 | int retval = 0; | ||
9082 | s64 val; | ||
9083 | char *end; | ||
9084 | |||
9085 | if (!nbytes) | ||
9086 | return -EINVAL; | ||
9087 | if (nbytes >= sizeof(buffer)) | ||
9088 | return -E2BIG; | ||
9089 | if (copy_from_user(buffer, userbuf, nbytes)) | ||
9090 | return -EFAULT; | ||
9091 | |||
9092 | buffer[nbytes] = 0; /* nul-terminate */ | ||
9093 | |||
9094 | /* strip newline if necessary */ | ||
9095 | if (nbytes && (buffer[nbytes-1] == '\n')) | ||
9096 | buffer[nbytes-1] = 0; | ||
9097 | val = simple_strtoll(buffer, &end, 0); | ||
9098 | if (*end) | ||
9099 | return -EINVAL; | ||
9100 | |||
9101 | /* Pass to subsystem */ | ||
9102 | retval = sched_group_set_rt_runtime(cgroup_tg(cgrp), val); | ||
9103 | if (!retval) | ||
9104 | retval = nbytes; | ||
9105 | return retval; | ||
9106 | } | 9079 | } |
9107 | 9080 | ||
9108 | static ssize_t cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft, | 9081 | static s64 cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft) |
9109 | struct file *file, | ||
9110 | char __user *buf, size_t nbytes, | ||
9111 | loff_t *ppos) | ||
9112 | { | 9082 | { |
9113 | char tmp[64]; | 9083 | return sched_group_rt_runtime(cgroup_tg(cgrp)); |
9114 | long val = sched_group_rt_runtime(cgroup_tg(cgrp)); | ||
9115 | int len = sprintf(tmp, "%ld\n", val); | ||
9116 | |||
9117 | return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); | ||
9118 | } | 9084 | } |
9119 | 9085 | ||
9120 | static int cpu_rt_period_write_uint(struct cgroup *cgrp, struct cftype *cftype, | 9086 | static int cpu_rt_period_write_uint(struct cgroup *cgrp, struct cftype *cftype, |
@@ -9133,20 +9099,20 @@ static struct cftype cpu_files[] = { | |||
9133 | #ifdef CONFIG_FAIR_GROUP_SCHED | 9099 | #ifdef CONFIG_FAIR_GROUP_SCHED |
9134 | { | 9100 | { |
9135 | .name = "shares", | 9101 | .name = "shares", |
9136 | .read_uint = cpu_shares_read_uint, | 9102 | .read_u64 = cpu_shares_read_u64, |
9137 | .write_uint = cpu_shares_write_uint, | 9103 | .write_u64 = cpu_shares_write_u64, |
9138 | }, | 9104 | }, |
9139 | #endif | 9105 | #endif |
9140 | #ifdef CONFIG_RT_GROUP_SCHED | 9106 | #ifdef CONFIG_RT_GROUP_SCHED |
9141 | { | 9107 | { |
9142 | .name = "rt_runtime_us", | 9108 | .name = "rt_runtime_us", |
9143 | .read = cpu_rt_runtime_read, | 9109 | .read_s64 = cpu_rt_runtime_read, |
9144 | .write = cpu_rt_runtime_write, | 9110 | .write_s64 = cpu_rt_runtime_write, |
9145 | }, | 9111 | }, |
9146 | { | 9112 | { |
9147 | .name = "rt_period_us", | 9113 | .name = "rt_period_us", |
9148 | .read_uint = cpu_rt_period_read_uint, | 9114 | .read_u64 = cpu_rt_period_read_uint, |
9149 | .write_uint = cpu_rt_period_write_uint, | 9115 | .write_u64 = cpu_rt_period_write_uint, |
9150 | }, | 9116 | }, |
9151 | #endif | 9117 | #endif |
9152 | }; | 9118 | }; |
@@ -9277,8 +9243,8 @@ out: | |||
9277 | static struct cftype files[] = { | 9243 | static struct cftype files[] = { |
9278 | { | 9244 | { |
9279 | .name = "usage", | 9245 | .name = "usage", |
9280 | .read_uint = cpuusage_read, | 9246 | .read_u64 = cpuusage_read, |
9281 | .write_uint = cpuusage_write, | 9247 | .write_u64 = cpuusage_write, |
9282 | }, | 9248 | }, |
9283 | }; | 9249 | }; |
9284 | 9250 | ||