mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][plugsched 25/28] Make public parts of schedstats
@ 2004-10-30 14:41 Con Kolivas
  0 siblings, 0 replies; only message in thread
From: Con Kolivas @ 2004-10-30 14:41 UTC (permalink / raw)
  To: linux
  Cc: Andrew Morton, Ingo Molnar, Peter Williams,
	William Lee Irwin III, Alexander Nyberg, Nick Piggin


[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-30 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-30 14:41 [PATCH][plugsched 25/28] Make public parts of schedstats Con Kolivas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome