From: NIWA Hideyuki <niwa.hideyuki@soft.fujitsu.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Class-based Kernel Resource Management
Date: Wed, 17 Sep 2003 14:08:59 +0900 [thread overview]
Message-ID: <20030917140859.77502e69.niwa.hideyuki@soft.fujitsu.com> (raw)
In-Reply-To: <3F563F01.3030207@watson.ibm.com>
I tried ckcpu patch.
However, echo command did not return from the kernel
when trying to create a new class through /proc I/F.
ex. echo 1 1 10 class1 > /proc/classes
Moreover, this process kept using CPU for a long time.
And, I cannot put a process into the class.
ex. echo 1 5560 > /proc/classes
I checked the source of ckcpu(ckcpu-A01-2.6.0-test2) and
made a simple patch as a workaround.
This patch is quick Hack.:-)
best regards,
NIWA
diff -Nru linux-2.6.0-test2/kernel/class.c linux-2.6.0-test2-ckcpu/kernel/class.c
--- linux-2.6.0-test2/kernel/class.c 2003-09-17 10:27:30.137358992 +0900
+++ linux-2.6.0-test2-ckcpu/kernel/class.c 2003-09-17 10:29:15.844289096 +0900
@@ -825,6 +825,7 @@
// kfree(arg);
}
+
struct seq_operations classes_op = {
.start = classes_start,
.next = classes_next,
@@ -846,27 +847,39 @@
{
char kbuf[MAX_CLASSES_WRITE+1];
char name[MAX_CLASSNAME_LEN];
- int classid,weight;
+ int classid,weight,pid;
int cmd;
if (count > MAX_CLASSES_WRITE)
return -EINVAL;
+
if (copy_from_user(&kbuf, buffer, count))
return -EFAULT;
- kbuf[MAX_CLASSES_WRITE] = '\0';
- if (sscanf(kbuf, "%d %d %d %s", &cmd, &classid, &weight, name) != 4)
- return -EINVAL;
+ kbuf[MAX_CLASSES_WRITE] = '\0';
- if (cmd == 1) {
- __create_class(classid,name,weight,0);
- return 0;
- }
+ sscanf(kbuf, "%d", &cmd);
- if (cmd == 2) {
- set_class(weight, classid);
+ switch (cmd) {
+ case 1:
+ if (sscanf(kbuf, "%d %d %d %s", &cmd, &classid, &weight, name)
+ == 4) {
+ __create_class(classid,name,weight,0);
+ return strlen(kbuf);
+ } else {
+ return -EINVAL;
+ }
+ case 2:
+ if (sscanf(kbuf, "%d %d %d", &cmd, &classid, &pid) == 3) {
+ set_class(pid, classid);
+ return strlen(kbuf);
+ } else {
+ return -EINVAL;
+ }
+ default:
+ return -EINVAL;
}
-
+
return -1;
}
@@ -951,6 +964,9 @@
void ckrm_cpu_change_class(struct task_struct *tsk,
struct ckrm_cpu_class *cls) {
+ if (cls == NULL) {
+ return;
+ }
set_class(tsk->pid,cls->class_id);
tsk->cpu_class = cls;
}
@@ -960,3 +976,5 @@
EXPORT_SYMBOL(ckrm_cpu_set_share);
EXPORT_SYMBOL(ckrm_cpu_get_usage);
EXPORT_SYMBOL(ckrm_dflt_cpu_class);
+EXPORT_SYMBOL(ckrm_cpu_change_class);
+
prev parent reply other threads:[~2003-09-17 5:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-29 19:51 Shailabh Nagar
2003-09-03 1:54 ` NIWA Hideyuki
2003-09-03 19:20 ` Shailabh Nagar
2003-09-17 5:08 ` NIWA Hideyuki [this message]
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=20030917140859.77502e69.niwa.hideyuki@soft.fujitsu.com \
--to=niwa.hideyuki@soft.fujitsu.com \
--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®