DragonFly BSD
DragonFly submit List (threaded) for 2003-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

proc extension request: p_sched


From: Peter Kadau <peter.kadau@xxxxxxxxxxxxxxxx>
Date: Sat, 27 Dec 2003 14:47:00 +0100

Hi !

May I have this in the tree ?
This way I can have my world and kernel always
in sync while testing userland scheduler variations.
The overhead shouldn't be much of a problem and the
struct sched can always be extended without recompiling
the world.

The struct runq there is only used as pointer and
declared in my scheduler extension - which freezes
my machine occassionly *sigh*...
If anyone of you kernel-insiders would like to comment
on my current code, I'd happily submit it of course.

Thanks and
Cheers
Peter

--
<peter.kadau@xxxxxxxxxxxxxxxx>

Campus der Max-Planck-Institute Tübingen
Netzwerk- und Systemadministration

Tel: +49 7071 601 598
Fax: +49 7071 601 616
diff -u -r src.orig/sys/kern/init_main.c src/sys/kern/init_main.c
--- src.orig/sys/kern/init_main.c	Mon Nov 10 07:12:13 2003
+++ src/sys/kern/init_main.c	Fri Dec 26 23:57:47 2003
@@ -87,6 +87,7 @@
 struct proc *initproc;
 struct proc proc0;
 struct thread thread0;
+struct sched sched0;
 
 int cmask = CMASK;
 extern	struct user *proc0paddr;
@@ -376,6 +377,8 @@
 	 */
 	p->p_stats = &p->p_addr->u_stats;
 	p->p_sigacts = &p->p_addr->u_sigacts;
+
+	p->p_sched = &sched0;
 
 	/*
 	 * Charge root for one process.
diff -u -r src.orig/sys/kern/kern_exit.c src/sys/kern/kern_exit.c
--- src.orig/sys/kern/kern_exit.c	Fri Nov 21 06:29:04 2003
+++ src/sys/kern/kern_exit.c	Sat Dec 27 13:30:47 2003
@@ -370,6 +370,9 @@
 		p->p_limit = NULL;
 	}
 
+	FREE(p->p_sched, M_SUBPROC);
+	p->p_sched = NULL;
+
 	/*
 	 * Release the P_CURPROC designation on the process so the userland
 	 * scheduler can work in someone else.
diff -u -r src.orig/sys/kern/kern_fork.c src/sys/kern/kern_fork.c
--- src.orig/sys/kern/kern_fork.c	Thu Nov 27 20:57:37 2003
+++ src/sys/kern/kern_fork.c	Fri Dec 26 23:59:26 2003
@@ -497,6 +497,11 @@
 	 */
 	p2->p_estcpu = p1->p_estcpu;
 
+	/* sched infrastructure */
+	MALLOC(p2->p_sched, struct sched *, sizeof(struct sched), M_SUBPROC, M_WAITOK);
+	p2->p_sched->sched_runq = NULL;
+	p2->p_sched->sched_flags = p1->p_sched->sched_flags;
+
 	/*
 	 * This begins the section where we must prevent the parent
 	 * from being swapped.
diff -u -r src.orig/sys/sys/proc.h src/sys/sys/proc.h
--- src.orig/sys/sys/proc.h	Sun Dec  7 05:20:38 2003
+++ src/sys/sys/proc.h	Sat Dec 27 13:29:00 2003
@@ -110,6 +110,7 @@
 	u_char	ar_args[0];	/* Arguments */
 };
 
+
 /*
  * Description of a process.
  *
@@ -122,6 +123,12 @@
  * is running.
  */
 
+struct runq;
+struct sched {
+	struct runq *sched_runq;
+	u_int32_t sched_flags;
+};
+
 struct jail;
 
 struct	proc {
@@ -232,6 +239,7 @@
 	void	*p_emuldata;	/* process-specific emulator state data */
 	struct thread *p_thread; /* temporarily embed thread struct in proc */
 	struct upcall *p_upcall; /* USERLAND POINTER! registered upcall */
+	struct sched *p_sched;	/* user scheduler info */
 };
 
 #if defined(_KERNEL)


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]