diff options
Diffstat (limited to 'kernel/user.c')
-rw-r--r-- | kernel/user.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/user.c b/kernel/user.c index 7d7900c5a1fd..9f6d471bfd03 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -164,9 +164,37 @@ static ssize_t cpu_shares_store(struct kobject *kobj, | |||
164 | static struct kobj_attribute cpu_share_attr = | 164 | static struct kobj_attribute cpu_share_attr = |
165 | __ATTR(cpu_share, 0644, cpu_shares_show, cpu_shares_store); | 165 | __ATTR(cpu_share, 0644, cpu_shares_show, cpu_shares_store); |
166 | 166 | ||
167 | static ssize_t cpu_rt_runtime_show(struct kobject *kobj, | ||
168 | struct kobj_attribute *attr, | ||
169 | char *buf) | ||
170 | { | ||
171 | struct user_struct *up = container_of(kobj, struct user_struct, kobj); | ||
172 | |||
173 | return sprintf(buf, "%lu\n", sched_group_rt_runtime(up->tg)); | ||
174 | } | ||
175 | |||
176 | static ssize_t cpu_rt_runtime_store(struct kobject *kobj, | ||
177 | struct kobj_attribute *attr, | ||
178 | const char *buf, size_t size) | ||
179 | { | ||
180 | struct user_struct *up = container_of(kobj, struct user_struct, kobj); | ||
181 | unsigned long rt_runtime; | ||
182 | int rc; | ||
183 | |||
184 | sscanf(buf, "%lu", &rt_runtime); | ||
185 | |||
186 | rc = sched_group_set_rt_runtime(up->tg, rt_runtime); | ||
187 | |||
188 | return (rc ? rc : size); | ||
189 | } | ||
190 | |||
191 | static struct kobj_attribute cpu_rt_runtime_attr = | ||
192 | __ATTR(cpu_rt_runtime, 0644, cpu_rt_runtime_show, cpu_rt_runtime_store); | ||
193 | |||
167 | /* default attributes per uid directory */ | 194 | /* default attributes per uid directory */ |
168 | static struct attribute *uids_attributes[] = { | 195 | static struct attribute *uids_attributes[] = { |
169 | &cpu_share_attr.attr, | 196 | &cpu_share_attr.attr, |
197 | &cpu_rt_runtime_attr.attr, | ||
170 | NULL | 198 | NULL |
171 | }; | 199 | }; |
172 | 200 | ||