mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>,
	Jack Steiner <steiner@sgi.com>, Jesse Barnes <jbarnes@sgi.com>,
	Paul Jackson <pj@sgi.com>, Dan Higgins <djh@sgi.com>,
	Matthew Dobson <colpatch@us.ibm.com>, Andi Kleen <ak@suse.de>,
	Sylvain <sylvain.jeaugey@bull.net>, Simon <Simon.Derr@bull.net>,
	Dimitri Sivanich <sivanich@sgi.com>
Subject: [patch 8/8] cpusets v4 - One more hook, for /proc/<pid>/cpuset.
Date: Fri, 2 Jul 2004 03:53:42 -0700 (PDT)	[thread overview]
Message-ID: <20040702105345.15684.90623.21358@sam.engr.sgi.com> (raw)
In-Reply-To: <20040702105147.15684.22242.27912@sam.engr.sgi.com>

Add cpuset links to /proc, from each task to its cpuset.

Index: 2.6.7-mm5/fs/proc/base.c
===================================================================
--- 2.6.7-mm5.orig/fs/proc/base.c	2004-07-01 19:30:10.000000000 -0700
+++ 2.6.7-mm5/fs/proc/base.c	2004-07-01 19:30:24.000000000 -0700
@@ -32,6 +32,7 @@
 #include <linux/mount.h>
 #include <linux/security.h>
 #include <linux/ptrace.h>
+#include <linux/cpuset.h>
 
 /*
  * For hysterical raisins we keep the same inumbers as in the old procfs.
@@ -60,6 +61,9 @@ enum pid_directory_inos {
 	PROC_TGID_MAPS,
 	PROC_TGID_MOUNTS,
 	PROC_TGID_WCHAN,
+#ifdef CONFIG_CPUSETS
+	PROC_TGID_CPUSET,
+#endif
 #ifdef CONFIG_SECURITY
 	PROC_TGID_ATTR,
 	PROC_TGID_ATTR_CURRENT,
@@ -83,6 +87,9 @@ enum pid_directory_inos {
 	PROC_TID_MAPS,
 	PROC_TID_MOUNTS,
 	PROC_TID_WCHAN,
+#ifdef CONFIG_CPUSETS
+	PROC_TID_CPUSET,
+#endif
 #ifdef CONFIG_SECURITY
 	PROC_TID_ATTR,
 	PROC_TID_ATTR_CURRENT,
@@ -123,6 +130,9 @@ static struct pid_entry tgid_base_stuff[
 #ifdef CONFIG_KALLSYMS
 	E(PROC_TGID_WCHAN,     "wchan",   S_IFREG|S_IRUGO),
 #endif
+#ifdef CONFIG_CPUSETS
+	E(PROC_TGID_CPUSET,    "cpuset", S_IFREG|S_IRUGO),
+#endif
 	{0,0,NULL,0}
 };
 static struct pid_entry tid_base_stuff[] = {
@@ -145,6 +155,9 @@ static struct pid_entry tid_base_stuff[]
 #ifdef CONFIG_KALLSYMS
 	E(PROC_TID_WCHAN,      "wchan",   S_IFREG|S_IRUGO),
 #endif
+#ifdef CONFIG_CPUSETS
+	E(PROC_TID_CPUSET,     "cpuset", S_IFREG|S_IRUGO),
+#endif
 	{0,0,NULL,0}
 };
 
@@ -767,6 +780,14 @@ static struct inode_operations proc_pid_
 	.follow_link	= proc_pid_follow_link
 };
 
+
+#ifdef CONFIG_CPUSETS
+static int proc_pid_cpuset(struct task_struct *task, char *buffer)
+{
+	return proc_pid_cspath(task, buffer, PAGE_SIZE);
+}
+#endif /* CONFIG_CPUSETS */
+
 static int pid_alive(struct task_struct *p)
 {
 	BUG_ON(p->pids[PIDTYPE_PID].pidptr != &p->pids[PIDTYPE_PID].pid);
@@ -1375,6 +1396,13 @@ static struct dentry *proc_pident_lookup
 			ei->op.proc_read = proc_pid_wchan;
 			break;
 #endif
+#ifdef CONFIG_CPUSETS
+		case PROC_TID_CPUSET:
+		case PROC_TGID_CPUSET:
+			inode->i_fop = &proc_info_file_operations;
+			ei->op.proc_read = proc_pid_cpuset;
+			break;
+#endif
 		default:
 			printk("procfs: impossible type (%d)",p->type);
 			iput(inode);
Index: 2.6.7-mm5/fs/proc/root.c
===================================================================
--- 2.6.7-mm5.orig/fs/proc/root.c	2004-07-01 19:30:10.000000000 -0700
+++ 2.6.7-mm5/fs/proc/root.c	2004-07-01 19:30:24.000000000 -0700
@@ -75,6 +75,9 @@ void __init proc_root_init(void)
 	proc_device_tree_init();
 #endif
 	proc_bus = proc_mkdir("bus", 0);
+#ifdef CONFIG_CPUSETS
+	proc_mkdir("cpusets", 0);
+#endif
 }
 
 static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd)

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

      parent reply	other threads:[~2004-07-02 11:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02 10:51 [patch 1/8] cpusets v4 - Table of Contents Paul Jackson
2004-07-02 10:52 ` [patch 2/8] cpusets v4 - Overview Paul Jackson
2004-07-02 10:52 ` [patch 3/8] cpusets v4 - cpumask_t - additional const qualifiers Paul Jackson
2004-07-02 10:52 ` [patch 4/8] cpusets v4 - nodemask patch (draft of Matthew Dobson's patch) Paul Jackson
2004-07-02 10:52 ` [patch 5/8] cpusets v4 - New bitmap lists format Paul Jackson
2004-07-02 10:53 ` [patch 6/8] cpusets v4 - The main new files: cpuset.c, cpuset.h Paul Jackson
2004-07-02 10:53 ` [patch 7/8] cpusets v4 - The few, small kernel hooks needed Paul Jackson
2004-07-02 10:53 ` Paul Jackson [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=20040702105345.15684.90623.21358@sam.engr.sgi.com \
    --to=pj@sgi.com \
    --cc=Simon.Derr@bull.net \
    --cc=ak@suse.de \
    --cc=colpatch@us.ibm.com \
    --cc=djh@sgi.com \
    --cc=hch@infradead.org \
    --cc=jbarnes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sivanich@sgi.com \
    --cc=steiner@sgi.com \
    --cc=sylvain.jeaugey@bull.net \
    /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®