All of lore.kernel.org
 help / color / mirror / Atom feed
From: Con Kolivas <kernel@kolivas.org>
To: linux <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	Peter Williams <pwil3058@bigpond.net.au>,
	William Lee Irwin III <wli@holomorphy.com>,
	Alexander Nyberg <alexn@dsv.su.se>,
	Nick Piggin <nickpiggin@yahoo.com.au>
Subject: [PATCH][plugsched 25/28] Make public parts of schedstats
Date: Sun, 31 Oct 2004 00:41:17 +1000	[thread overview]
Message-ID: <4183A80D.3090705@kolivas.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 33 bytes --]

Make public parts of schedstats


[-- Attachment #1.2: publicise_schedstats.diff --]
[-- Type: text/x-patch, Size: 4103 bytes --]

Take the common functions of schedstats out, and privatise those that are
scheduler design dependant.

Signed-off-by: Con Kolivas <kernel@kolivas.org>


Index: linux-2.6.10-rc1-mm2-plugsched1/include/linux/sched.h
===================================================================
--- linux-2.6.10-rc1-mm2-plugsched1.orig/include/linux/sched.h	2004-10-30 00:20:11.034827926 +1000
+++ linux-2.6.10-rc1-mm2-plugsched1/include/linux/sched.h	2004-10-30 00:20:12.649569607 +1000
@@ -32,6 +32,7 @@
 #include <linux/pid.h>
 #include <linux/percpu.h>
 #include <linux/topology.h>
+#include <linux/seq_file.h>
 
 struct exec_domain;
 
Index: linux-2.6.10-rc1-mm2-plugsched1/include/linux/scheduler.h
===================================================================
--- linux-2.6.10-rc1-mm2-plugsched1.orig/include/linux/scheduler.h	2004-10-30 00:19:31.771109110 +1000
+++ linux-2.6.10-rc1-mm2-plugsched1/include/linux/scheduler.h	2004-10-30 00:20:12.649569607 +1000
@@ -46,6 +46,9 @@ struct sched_drv
 	void (*wait_task_inactive)(task_t *);
 	void (*cpu_attach_domain)(struct sched_domain *, int);
 #endif
+#ifdef CONFIG_SCHEDSTATS
+	int (*show_schedstat)(struct seq_file *, void *);
+#endif
 };
 
 /*
Index: linux-2.6.10-rc1-mm2-plugsched1/kernel/sched.c
===================================================================
--- linux-2.6.10-rc1-mm2-plugsched1.orig/kernel/sched.c	2004-10-30 00:20:11.036827607 +1000
+++ linux-2.6.10-rc1-mm2-plugsched1/kernel/sched.c	2004-10-30 00:20:12.651569288 +1000
@@ -348,7 +348,7 @@ static inline void task_rq_unlock(runque
  */
 #define SCHEDSTAT_VERSION 10
 
-static int show_schedstat(struct seq_file *seq, void *v)
+static int ingo_show_schedstat(struct seq_file *seq, void *v)
 {
 	int cpu;
 	enum idle_type itype;
@@ -407,32 +407,6 @@ static int show_schedstat(struct seq_fil
 	return 0;
 }
 
-static int schedstat_open(struct inode *inode, struct file *file)
-{
-	unsigned int size = PAGE_SIZE * (1 + num_online_cpus() / 32);
-	char *buf = kmalloc(size, GFP_KERNEL);
-	struct seq_file *m;
-	int res;
-
-	if (!buf)
-		return -ENOMEM;
-	res = single_open(file, show_schedstat, NULL);
-	if (!res) {
-		m = file->private_data;
-		m->buf = buf;
-		m->size = size;
-	} else
-		kfree(buf);
-	return res;
-}
-
-struct file_operations proc_schedstat_operations = {
-	.open    = schedstat_open,
-	.read    = seq_read,
-	.llseek  = seq_lseek,
-	.release = single_release,
-};
-
 # define schedstat_inc(rq, field)	rq->field++;
 # define schedstat_add(rq, field, amt)	rq->field += amt;
 #else /* !CONFIG_SCHEDSTATS */
@@ -4149,4 +4123,7 @@ struct sched_drv ingo_sched_drv = {
 	.sched_idle_next	= ingo_sched_idle_next,
 #endif	
 #endif
+#ifdef CONFIG_SCHEDSTATS
+	.show_schedstat		= ingo_show_schedstat,
+#endif
 };
Index: linux-2.6.10-rc1-mm2-plugsched1/kernel/scheduler.c
===================================================================
--- linux-2.6.10-rc1-mm2-plugsched1.orig/kernel/scheduler.c	2004-10-30 00:20:11.037827447 +1000
+++ linux-2.6.10-rc1-mm2-plugsched1/kernel/scheduler.c	2004-10-30 00:20:12.652569128 +1000
@@ -928,6 +928,36 @@ void __devinit init_sched_build_groups(s
 }
 #endif
 
+#ifdef CONFIG_SCHEDSTATS
+int show_schedstat(struct seq_file *seq, void *v);
+
+static int schedstat_open(struct inode *inode, struct file *file)
+{
+	unsigned int size = PAGE_SIZE * (1 + num_online_cpus() / 32);
+	char *buf = kmalloc(size, GFP_KERNEL);
+	struct seq_file *m;
+	int res;
+
+	if (!buf)
+		return -ENOMEM;
+	res = single_open(file, show_schedstat, NULL);
+	if (!res) {
+		m = file->private_data;
+		m->buf = buf;
+		m->size = size;
+	} else
+		kfree(buf);
+	return res;
+}
+
+struct file_operations proc_schedstat_operations = {
+	.open    = schedstat_open,
+	.read    = seq_read,
+	.llseek  = seq_lseek,
+	.release = single_release,
+};
+#endif
+
 extern struct sched_drv ingo_sched_drv;
 
 struct sched_drv *scheduler =
@@ -1136,3 +1166,10 @@ asmlinkage void schedule_tail(task_t *ta
 {
 	scheduler->tail(task);
 }
+
+#ifdef CONFIG_SCHEDSTATS
+int show_schedstat(struct seq_file *seq, void *v)
+{
+	return scheduler->show_schedstat(seq, v);
+}
+#endif


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

                 reply	other threads:[~2004-10-30 15:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4183A80D.3090705@kolivas.org \
    --to=kernel@kolivas.org \
    --cc=akpm@osdl.org \
    --cc=alexn@dsv.su.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=pwil3058@bigpond.net.au \
    --cc=wli@holomorphy.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.