DragonFly submit List (threaded) for 2005-12
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
usched questions and a patch
Hello hackers!
I've got a question about the TAILQ_ENTRY(lwp) lwp_procq in struct lwp - why
isn't it a part of lwp_usdata union? Isn't it a usched-dependent data? What
if a different usched wants to hold its lwps in e.g. red-black tree or a
heap?
Another thing I noticed is that usched_set() syscall does not zero the
content of lwp_usdata which makes impossible for the newly selected usched
to distinguish between an lwp it already had on its queue/tree/whatever and
had already put some data into its lwp_usdata, and a 'new' lwp it will get in
the following call to acquire_curproc() from userexit() IIRC.
What do You think about the attached patch?
And one more thing - what do You think about adding another usched API call,
e.g. exiting_curproc() called from exit1() instead of release_curproc() so
that a usched could (1) actually trace lwps during their lifetime and
(2) differentiate between lwps 'only' going into kernel and the ones that do
exit1()?
--
Michal Belczyk
Index: bin/ps/keyword.c
===================================================================
RCS file: /home/dcvs/src/bin/ps/keyword.c,v
retrieving revision 1.21
diff -u -r1.21 keyword.c
--- bin/ps/keyword.c 11 Oct 2005 22:10:22 -0000 1.21
+++ bin/ps/keyword.c 20 Dec 2005 19:02:34 -0000
@@ -153,8 +153,6 @@
{"re", "RE", NULL, 0, pvar, NULL, 3, POFF(p_swtime), UINT, "d", NULL},
{"rgid", "RGID", NULL, 0, evar, NULL, UIDLEN, EOFF(e_ucred.cr_rgid),
UINT, UIDFMT, NULL},
- {"rlink", "RLINK", NULL, 0, pvar, NULL, 8, POFF(p_lwp.lwp_procq.tqe_prev), KPTR, "lx",
- NULL},
{"rss", "RSS", NULL, 0, p_rssize, NULL, 4, 0, 0, NULL, NULL},
{"rssize", "", "rsz", 0, NULL, NULL, 0, 0, 0, NULL, NULL},
{"rsz", "RSZ", NULL, 0, rssize, NULL, 4, 0, 0, NULL, NULL},
Index: bin/ps/ps.1
===================================================================
RCS file: /home/dcvs/src/bin/ps/ps.1,v
retrieving revision 1.7
diff -u -r1.7 ps.1
--- bin/ps/ps.1 14 Nov 2005 18:49:48 -0000 1.7
+++ bin/ps/ps.1 20 Dec 2005 19:03:29 -0000
@@ -424,8 +424,6 @@
.It rgid
real group
.Tn ID
-.It rlink
-reverse link on run queue, or 0
.It rss
resident set size
.It rsz
Index: sys/kern/kern_usched.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/kern_usched.c,v
retrieving revision 1.1
diff -u -r1.1 kern_usched.c
--- sys/kern/kern_usched.c 16 Nov 2005 02:24:30 -0000 1.1
+++ sys/kern/kern_usched.c 20 Dec 2005 19:42:18 -0000
@@ -161,6 +161,11 @@
if (item && item != p->p_usched) {
p->p_usched->release_curproc(&p->p_lwp);
p->p_usched = item;
+ /*
+ * Give the new usched a chance to recognize the lwp
+ * as a 'new' one.
+ */
+ bzero(&p->p_lwp.lwp_usdata, sizeof(p->p_lwp.lwp_usdata));
} else if (item == NULL) {
error = EINVAL;
}
Index: sys/kern/usched_bsd4.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/usched_bsd4.c,v
retrieving revision 1.6
diff -u -r1.6 usched_bsd4.c
--- sys/kern/usched_bsd4.c 21 Nov 2005 21:59:50 -0000 1.6
+++ sys/kern/usched_bsd4.c 20 Dec 2005 18:59:29 -0000
@@ -81,6 +81,7 @@
#define lwp_rqindex lwp_usdata.bsd4.rqindex
#define lwp_origcpu lwp_usdata.bsd4.origcpu
#define lwp_estcpu lwp_usdata.bsd4.estcpu
+#define lwp_procq lwp_usdata.bsd4.lwp_procq
static void bsd4_acquire_curproc(struct lwp *lp);
static void bsd4_release_curproc(struct lwp *lp);
Index: sys/sys/proc.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/proc.h,v
retrieving revision 1.73
diff -u -r1.73 proc.h
--- sys/sys/proc.h 1 Dec 2005 18:30:10 -0000 1.73
+++ sys/sys/proc.h 20 Dec 2005 18:58:21 -0000
@@ -132,7 +132,6 @@
struct jail;
struct lwp {
- TAILQ_ENTRY(lwp) lwp_procq; /* run/sleep queue. */
LIST_ENTRY(lwp) lwp_list; /* List of all threads in the proc. */
struct proc *lwp_proc; /* Link to our proc. */
Index: sys/sys/usched.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/usched.h,v
retrieving revision 1.7
diff -u -r1.7 usched.h
--- sys/sys/usched.h 16 Nov 2005 02:24:33 -0000 1.7
+++ sys/sys/usched.h 20 Dec 2005 18:58:18 -0000
@@ -42,6 +42,7 @@
* BSD4 scheduler.
*/
struct {
+ TAILQ_ENTRY(lwp) lwp_procq; /* run/sleep queue. */
short priority; /* lower is better */
char interactive; /* (currently not used) */
char rqindex;
@@ -49,7 +50,7 @@
int estcpu; /* dynamic priority modification */
} bsd4;
- int pad[4]; /* PAD for future expansion */
+ int pad[8]; /* PAD for future expansion */
};
/*
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]