diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-02-13 15:45:39 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-02-13 15:45:39 +0100 |
commit | 9f0c1e560c43327b70998e6c702b2f01321130d9 (patch) | |
tree | b2cc7ef5bb0dc9d7d2912de339bff3e0db3530c9 /kernel/user.c | |
parent | sched: rt-group: deal with PI (diff) | |
download | linux-9f0c1e560c43327b70998e6c702b2f01321130d9.tar.xz linux-9f0c1e560c43327b70998e6c702b2f01321130d9.zip |
sched: rt-group: interface
Change the rt_ratio interface to rt_runtime_us, to match rt_period_us.
This avoids picking a granularity for the ratio.
Extend the /sys/kernel/uids/<uid>/ interface to allow setting
the group's rt_runtime.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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, static struct kobj_attribute cpu_share_attr = __ATTR(cpu_share, 0644, cpu_shares_show, cpu_shares_store); +static ssize_t cpu_rt_runtime_show(struct kobject *kobj, + struct kobj_attribute *attr, + char *buf) +{ + struct user_struct *up = container_of(kobj, struct user_struct, kobj); + + return sprintf(buf, "%lu\n", sched_group_rt_runtime(up->tg)); +} + +static ssize_t cpu_rt_runtime_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t size) +{ + struct user_struct *up = container_of(kobj, struct user_struct, kobj); + unsigned long rt_runtime; + int rc; + + sscanf(buf, "%lu", &rt_runtime); + + rc = sched_group_set_rt_runtime(up->tg, rt_runtime); + + return (rc ? rc : size); +} + +static struct kobj_attribute cpu_rt_runtime_attr = + __ATTR(cpu_rt_runtime, 0644, cpu_rt_runtime_show, cpu_rt_runtime_store); + /* default attributes per uid directory */ static struct attribute *uids_attributes[] = { &cpu_share_attr.attr, + &cpu_rt_runtime_attr.attr, NULL }; |