PERFORCE change 103223 for review
John Birrell
jb at FreeBSD.org
Sat Aug 5 04:18:14 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=103223
Change 103223 by jb at jb_freebsd2 on 2006/08/05 04:18:03
Merge the MPSAFE changes from current.
Merge KSE support back in under the kernel option KSE.
Affected files ...
.. //depot/projects/dtrace/src/sys/kern/kern_proc.c#3 edit
Differences ...
==== //depot/projects/dtrace/src/sys/kern/kern_proc.c#3 (text+ko) ====
@@ -142,6 +142,9 @@
{
struct proc *p;
struct thread *td;
+#if defined(INVARIANTS) && defined(KSE)
+ struct ksegrp *kg;
+#endif
/* INVARIANTS checks go here */
p = (struct proc *)mem;
@@ -149,7 +152,14 @@
#ifdef INVARIANTS
KASSERT((p->p_numthreads == 1),
("bad number of threads in exiting process"));
+#ifdef KSE
+ KASSERT((p->p_numksegrps == 1), ("free proc with > 1 ksegrp"));
+#endif
KASSERT((td != NULL), ("proc_dtor: bad thread pointer"));
+#ifdef KSE
+ kg = FIRST_KSEGRP_IN_PROC(p);
+ KASSERT((kg != NULL), ("proc_dtor: bad kg pointer"));
+#endif
KASSERT(STAILQ_EMPTY(&p->p_ktr), ("proc_dtor: non-empty p_ktr"));
#endif
@@ -172,14 +182,25 @@
{
struct proc *p;
struct thread *td;
+#ifdef KSE
+ struct ksegrp *kg;
+#endif
p = (struct proc *)mem;
p->p_sched = (struct p_sched *)&p[1];
td = thread_alloc();
+#ifdef KSE
+ kg = ksegrp_alloc();
+#endif
bzero(&p->p_mtx, sizeof(struct mtx));
mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
p->p_stats = pstats_alloc();
+#ifdef KSE
+ proc_linkup(p, kg, td);
+ sched_newproc(p, kg, td);
+#else
proc_linkup(p, td);
+#endif
return (0);
}
@@ -195,6 +216,9 @@
p = (struct proc *)mem;
pstats_free(p->p_stats);
+#ifdef KSE
+ ksegrp_free(FIRST_KSEGRP_IN_PROC(p));
+#endif
thread_free(FIRST_THREAD_IN_PROC(p));
mtx_destroy(&p->p_mtx);
if (p->p_ksi != NULL)
@@ -750,6 +774,9 @@
static void
fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp)
{
+#ifdef KSE
+ struct ksegrp *kg;
+#endif
struct proc *p;
p = td->td_proc;
@@ -789,6 +816,15 @@
kp->ki_stat = SIDL;
}
+#ifdef KSE
+ kg = td->td_ksegrp;
+
+ /* things in the KSE GROUP */
+ kp->ki_estcpu = kg->kg_estcpu;
+ kp->ki_slptime = kg->kg_slptime;
+ kp->ki_pri.pri_user = kg->kg_user_pri;
+ kp->ki_pri.pri_class = kg->kg_pri_class;
+#endif
/* Things in the thread */
kp->ki_wchan = td->td_wchan;
kp->ki_pri.pri_level = td->td_priority;
@@ -801,10 +837,12 @@
kp->ki_pcb = td->td_pcb;
kp->ki_kstack = (void *)td->td_kstack;
kp->ki_pctcpu = sched_pctcpu(td);
+#ifndef KSE
kp->ki_estcpu = td->td_estcpu;
kp->ki_slptime = td->td_slptime;
kp->ki_pri.pri_class = td->td_pri_class;
kp->ki_pri.pri_user = td->td_user_pri;
+#endif
/* We can't get this anymore but ps etc never used it anyway. */
kp->ki_rqindex = 0;
@@ -1268,44 +1306,38 @@
static SYSCTL_NODE(_kern, KERN_PROC, proc, CTLFLAG_RD, 0, "Process table");
-SYSCTL_PROC(_kern_proc, KERN_PROC_ALL, all,
- CTLFLAG_RD|CTLTYPE_STRUCT|CTLFLAG_MPSAFE,
+SYSCTL_PROC(_kern_proc, KERN_PROC_ALL, all, CTLFLAG_RD|CTLTYPE_STRUCT,
0, 0, sysctl_kern_proc, "S,proc", "Return entire process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_GID, gid, CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_GID, gid, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_PGRP, pgrp,
- CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_PGRP, pgrp, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_RGID, rgid,
- CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_RGID, rgid, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_SESSION, sid,
- CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_SESSION, sid, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_RUID, ruid,
- CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_RUID, ruid, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_PID, pid, CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_PID, pid, CTLFLAG_RD,
sysctl_kern_proc, "Process table");
-static SYSCTL_NODE(_kern_proc, KERN_PROC_PROC, proc,
- CTLFLAG_RD|CTLFLAG_MPSAFE,
+static SYSCTL_NODE(_kern_proc, KERN_PROC_PROC, proc, CTLFLAG_RD,
sysctl_kern_proc, "Return process table, no threads");
static SYSCTL_NODE(_kern_proc, KERN_PROC_ARGS, args,
- CTLFLAG_RW | CTLFLAG_ANYBODY | CTLFLAG_MPSAFE,
+ CTLFLAG_RW | CTLFLAG_ANYBODY,
sysctl_kern_proc_args, "Process argument list");
static SYSCTL_NODE(_kern_proc, KERN_PROC_PATHNAME, pathname, CTLFLAG_RD,
@@ -1315,29 +1347,28 @@
sysctl_kern_proc_sv_name, "Process syscall vector name (ABI type)");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_GID | KERN_PROC_INC_THREAD), gid_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_PGRP | KERN_PROC_INC_THREAD), pgrp_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_RGID | KERN_PROC_INC_THREAD), rgid_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_SESSION | KERN_PROC_INC_THREAD),
- sid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ sid_td, CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_TTY | KERN_PROC_INC_THREAD), tty_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_UID | KERN_PROC_INC_THREAD), uid_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_RUID | KERN_PROC_INC_THREAD), ruid_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_PID | KERN_PROC_INC_THREAD), pid_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table");
+ CTLFLAG_RD, sysctl_kern_proc, "Process table");
static SYSCTL_NODE(_kern_proc, (KERN_PROC_PROC | KERN_PROC_INC_THREAD), proc_td,
- CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc,
- "Return process table, no threads");
+ CTLFLAG_RD, sysctl_kern_proc, "Return process table, no threads");
More information about the p4-projects
mailing list