From: sekharan@us.ibm.com
To: linux-kernel@vger.kernel.org, ckrm-tech@lists.sourceforge.net
Cc: sekharan@us.ibm.com
Subject: [RFC] [PATCH 06/12] Add proc interface to get class info of task
Date: Thu, 20 Apr 2006 19:24:45 -0700 [thread overview]
Message-ID: <20060421022445.6145.79833.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060421022411.6145.83939.sendpatchset@localhost.localdomain>
06/12: ckrm_tasksupport_procsupport
Adds an interface in /proc to get the class name of a task.
--
Signed-Off-By: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: MAEDA Naoaki <maeda.naoaki@jp.fujitsu.com>
fs/proc/base.c | 19 +++++++++++++++++++
include/linux/ckrm.h | 2 ++
kernel/ckrm/ckrm_task.c | 32 +++++++++++++++++++++++++++++++-
3 files changed, 52 insertions(+), 1 deletion(-)
Index: linux2617-rc2/fs/proc/base.c
===================================================================
--- linux2617-rc2.orig/fs/proc/base.c
+++ linux2617-rc2/fs/proc/base.c
@@ -70,6 +70,7 @@
#include <linux/ptrace.h>
#include <linux/seccomp.h>
#include <linux/cpuset.h>
+#include <linux/ckrm.h>
#include <linux/audit.h>
#include <linux/poll.h>
#include "internal.h"
@@ -115,6 +116,9 @@ enum pid_directory_inos {
#ifdef CONFIG_CPUSETS
PROC_TGID_CPUSET,
#endif
+#ifdef CONFIG_CKRM
+ PROC_TGID_CKRM_CLASS,
+#endif
#ifdef CONFIG_SECURITY
PROC_TGID_ATTR,
PROC_TGID_ATTR_CURRENT,
@@ -156,6 +160,9 @@ enum pid_directory_inos {
#ifdef CONFIG_CPUSETS
PROC_TID_CPUSET,
#endif
+#ifdef CONFIG_CKRM
+ PROC_TID_CKRM_CLASS,
+#endif
#ifdef CONFIG_SECURITY
PROC_TID_ATTR,
PROC_TID_ATTR_CURRENT,
@@ -219,6 +226,9 @@ static struct pid_entry tgid_base_stuff[
#ifdef CONFIG_CPUSETS
E(PROC_TGID_CPUSET, "cpuset", S_IFREG|S_IRUGO),
#endif
+#ifdef CONFIG_CKRM
+ E(PROC_TGID_CKRM_CLASS,"ckrm_class",S_IFREG|S_IRUGO),
+#endif
E(PROC_TGID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO),
E(PROC_TGID_OOM_ADJUST,"oom_adj", S_IFREG|S_IRUGO|S_IWUSR),
#ifdef CONFIG_AUDITSYSCALL
@@ -261,6 +271,9 @@ static struct pid_entry tid_base_stuff[]
#ifdef CONFIG_CPUSETS
E(PROC_TID_CPUSET, "cpuset", S_IFREG|S_IRUGO),
#endif
+#ifdef CONFIG_CKRM
+ E(PROC_TID_CKRM_CLASS, "ckrm_class",S_IFREG|S_IRUGO),
+#endif
E(PROC_TID_OOM_SCORE, "oom_score",S_IFREG|S_IRUGO),
E(PROC_TID_OOM_ADJUST, "oom_adj", S_IFREG|S_IRUGO|S_IWUSR),
#ifdef CONFIG_AUDITSYSCALL
@@ -1814,6 +1827,12 @@ static struct dentry *proc_pident_lookup
inode->i_fop = &proc_cpuset_operations;
break;
#endif
+#ifdef CONFIG_CKRM
+ case PROC_TID_CKRM_CLASS:
+ case PROC_TGID_CKRM_CLASS:
+ inode->i_fop = &proc_ckrm_class_operations;
+ break;
+#endif
case PROC_TID_OOM_SCORE:
case PROC_TGID_OOM_SCORE:
inode->i_fop = &proc_info_file_operations;
Index: linux2617-rc2/kernel/ckrm/ckrm_task.c
===================================================================
--- linux2617-rc2.orig/kernel/ckrm/ckrm_task.c
+++ linux2617-rc2/kernel/ckrm/ckrm_task.c
@@ -13,7 +13,8 @@
* (at your option) any later version.
*
*/
-#include <linux/sched.h>
+#include <linux/seq_file.h>
+#include <linux/proc_fs.h>
#include <linux/module.h>
#include "ckrm_local.h"
@@ -193,4 +194,33 @@ next_task:
kref_put(&class->ref, ckrm_release_class);
}
+static int proc_ckrm_class_show(struct seq_file *m, void *v)
+{
+ struct task_struct *tsk = m->private;
+ struct ckrm_class *class = tsk->class;
+
+ if (!class)
+ return -EINVAL;
+
+ kref_get(&class->ref);
+ seq_puts(m, "/");
+ if (!ckrm_is_class_root(class))
+ seq_puts(m, class->name);
+ seq_putc(m, '\n');
+ kref_put(&class->ref, ckrm_release_class);
+ return 0;
+}
+
+static int ckrm_class_open(struct inode *inode, struct file *file)
+{
+ struct task_struct *tsk = PROC_I(inode)->task;
+ return single_open(file, proc_ckrm_class_show, tsk);
+}
+
+struct file_operations proc_ckrm_class_operations = {
+ .open = ckrm_class_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
EXPORT_SYMBOL_GPL(ckrm_setclass);
Index: linux2617-rc2/include/linux/ckrm.h
===================================================================
--- linux2617-rc2.orig/include/linux/ckrm.h
+++ linux2617-rc2/include/linux/ckrm.h
@@ -94,6 +94,8 @@ struct ckrm_class {
struct list_head children; /* head of children */
};
+extern struct file_operations proc_ckrm_class_operations;
+
extern void ckrm_init_task(struct task_struct *);
extern void ckrm_clear_task(struct task_struct *);
extern void ckrm_init(void);
--
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- sekharan@us.ibm.com | .......you may get it.
----------------------------------------------------------------------
next prev parent reply other threads:[~2006-04-21 2:32 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 2:24 [RFC] [PATCH 00/12] CKRM after a major overhaul sekharan
2006-04-21 2:24 ` [RFC] [PATCH 01/12] Register/Unregister interface for Controllers sekharan
2006-04-21 2:24 ` [RFC] [PATCH 02/12] Class creation/deletion sekharan
2006-04-21 2:24 ` [RFC] [PATCH 03/12] Share Handling sekharan
2006-04-21 2:24 ` [RFC] [PATCH 04/12] Add task logic to class sekharan
2006-04-21 2:24 ` [RFC] [PATCH 05/12] Init and clear class info in task sekharan
2006-04-21 2:24 ` sekharan [this message]
2006-04-21 2:24 ` [RFC] [PATCH 07/12] Configfs based filesystem user interface - RCFS sekharan
2006-04-21 2:24 ` [RFC] [PATCH 08/12] Add attribute support to RCFS sekharan
2006-04-21 2:25 ` [RFC] [PATCH 09/12] Add stats file " sekharan
2006-04-21 2:25 ` [RFC] [PATCH 10/12] Add shares " sekharan
2006-04-21 2:25 ` [RFC] [PATCH 11/12] Add members " sekharan
2006-04-21 2:25 ` [RFC] [PATCH 12/12] Documentation for CKRM sekharan
2006-04-21 14:49 ` [ckrm-tech] [RFC] [PATCH 00/12] CKRM after a major overhaul Dave Hansen
2006-04-21 16:58 ` Chandra Seetharaman
2006-04-21 22:57 ` Andrew Morton
2006-04-22 1:48 ` Chandra Seetharaman
2006-04-22 2:13 ` Andrew Morton
2006-04-22 2:20 ` Matt Helsley
2006-04-22 2:33 ` Andrew Morton
2006-04-22 5:28 ` Chandra Seetharaman
2006-04-24 1:10 ` KUROSAWA Takahiro
2006-04-24 4:39 ` Kirill Korotaev
2006-04-24 5:41 ` KUROSAWA Takahiro
2006-04-24 6:45 ` Kirill Korotaev
2006-04-24 7:12 ` KUROSAWA Takahiro
2006-04-24 5:18 ` Hirokazu Takahashi
2006-04-25 1:42 ` Chandra Seetharaman
2006-04-23 6:52 ` Paul Jackson
2006-04-23 9:31 ` Matt Helsley
2006-04-28 1:58 ` Chandra Seetharaman
2006-04-28 6:07 ` Kirill Korotaev
2006-04-28 17:57 ` Chandra Seetharaman
2006-04-24 1:47 ` Hirokazu Takahashi
2006-04-24 20:42 ` Shailabh Nagar
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=20060421022445.6145.79833.sendpatchset@localhost.localdomain \
--to=sekharan@us.ibm.com \
--cc=ckrm-tech@lists.sourceforge.net \
--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