From: menage@google.com
To: Peter Zijlstra <a.p.zijlstra@chello.nl>, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org
Subject: [PATCH 2/2] CGroups _s64 files: Use read_s64/write_s64 in CFS cgroup for rt_runtime file
Date: Wed, 05 Mar 2008 02:20:27 -0800 [thread overview]
Message-ID: <20080305102513.610692000@menage.corp.google.com> (raw)
In-Reply-To: <20080305102025.677459000@menage.corp.google.com>
[-- Attachment #1: cfs_use_readwrite_s64.patch --]
[-- Type: text/plain, Size: 2159 bytes --]
This removes some filesystem boilerplate from the CFS cgroup subsystem.
Signed-off-by: Paul Menage <menage@google.com>
---
kernel/sched.c | 52 +++++++++-------------------------------------------
1 file changed, 9 insertions(+), 43 deletions(-)
Index: read_s64-2.6.25-rc3-mm1/kernel/sched.c
===================================================================
--- read_s64-2.6.25-rc3-mm1.orig/kernel/sched.c
+++ read_s64-2.6.25-rc3-mm1/kernel/sched.c
@@ -8081,48 +8081,14 @@ static u64 cpu_shares_read_u64(struct cg
#ifdef CONFIG_RT_GROUP_SCHED
static int cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft,
- struct file *file,
- const char __user *userbuf,
- size_t nbytes, loff_t *unused_ppos)
-{
- char buffer[64];
- int retval = 0;
- s64 val;
- char *end;
-
- if (!nbytes)
- return -EINVAL;
- if (nbytes >= sizeof(buffer))
- return -E2BIG;
- if (copy_from_user(buffer, userbuf, nbytes))
- return -EFAULT;
-
- buffer[nbytes] = 0; /* nul-terminate */
-
- /* strip newline if necessary */
- if (nbytes && (buffer[nbytes-1] == '\n'))
- buffer[nbytes-1] = 0;
- val = simple_strtoll(buffer, &end, 0);
- if (*end)
- return -EINVAL;
-
- /* Pass to subsystem */
- retval = sched_group_set_rt_runtime(cgroup_tg(cgrp), val);
- if (!retval)
- retval = nbytes;
- return retval;
-}
-
-static ssize_t cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft,
- struct file *file,
- char __user *buf, size_t nbytes,
- loff_t *ppos)
-{
- char tmp[64];
- long val = sched_group_rt_runtime(cgroup_tg(cgrp));
- int len = sprintf(tmp, "%ld\n", val);
+ s64 val)
+{
+ return sched_group_set_rt_runtime(cgroup_tg(cgrp), val);
+}
- return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
+static s64 cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft)
+{
+ return sched_group_rt_runtime(cgroup_tg(cgrp));
}
#endif
@@ -8137,8 +8103,8 @@ static struct cftype cpu_files[] = {
#ifdef CONFIG_RT_GROUP_SCHED
{
.name = "rt_runtime_us",
- .read = cpu_rt_runtime_read,
- .write = cpu_rt_runtime_write,
+ .read_s64 = cpu_rt_runtime_read,
+ .write_s64 = cpu_rt_runtime_write,
},
#endif
};
--
next prev parent reply other threads:[~2008-03-05 10:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 10:20 [PATCH 0/2] CGroups _s64 files: Intro menage
2008-03-05 10:20 ` [PATCH 1/2] CGroups _s64 files: Add cgroups read_s64/write_s64 file methods menage
2008-03-05 10:20 ` menage [this message]
2008-03-05 10:29 ` [PATCH 0/2] CGroups _s64 files: Intro Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080305102513.610692000@menage.corp.google.com \
--to=menage@google.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®