PERFORCE change 50315 for review

Julian Elischer julian at FreeBSD.org
Sat Apr 3 22:48:36 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=50315

Change 50315 by julian at julian_jules1 on 2004/04/03 22:48:02

	rethink when teh sched specific regions get cleared.
	probably needs more thought.

Affected files ...

.. //depot/projects/nsched/sys/kern/init_main.c#4 edit
.. //depot/projects/nsched/sys/kern/kern_thread.c#4 edit

Differences ...

==== //depot/projects/nsched/sys/kern/init_main.c#4 (text+ko) ====


==== //depot/projects/nsched/sys/kern/kern_thread.c#4 (text+ko) ====

@@ -169,6 +169,7 @@
 	td->td_state = TDS_INACTIVE;
 	td->td_oncpu	= NOCPU;
 	td->td_critnest = 1;
+	sched_newthread(td);
 }
 
 /*
@@ -235,6 +236,7 @@
 	td->td_sleepqueue = sleepq_alloc();
 	td->td_turnstile = turnstile_alloc();
 	td->td_sched = (struct td_sched *)&td[1];
+
 }
 
 /*
@@ -252,6 +254,18 @@
 }
 
 /*
+ * Prepare a ksegrp for use.
+ */
+static void
+thread_ctor(void *mem, int size, void *arg)
+{
+	struct ksegrp	*kg;
+
+	ke = (struct ksegrp *)mem;
+	sched_newkseg(kg);
+}
+
+/*
  * Initialize type-stable parts of a ksegrp (when newly created).
  */
 static void
@@ -279,7 +293,6 @@
 	kg->kg_numthreads = 0;
 	kg->kg_runnable   = 0;
 	kg->kg_numupcalls = 0;
-	sched_newkseg(kg);
 	/* link it in now that it's consistent */
 	p->p_numksegrps++;
 	TAILQ_INSERT_HEAD(&p->p_ksegrps, kg, kg_ksegrp);
@@ -369,6 +382,8 @@
 
 	ksegrp_link(kg, p);
 	thread_link(td, kg);
+	sched_newthread(td);
+	sched_newkseg(kg);
 }
 
 #ifndef _SYS_SYSPROTO_H_
@@ -601,7 +616,7 @@
 	p = td->td_proc;
 	td2 = NULL;
 	ku = NULL;
-	/* KSE-enabled processes only, please. */
+	/* kSE-enabled processes only, please. */
 	if (!(p->p_flag & P_SA))
 		return (EINVAL);
 	PROC_LOCK(p);
@@ -827,7 +842,7 @@
 	tid_zone = uma_zcreate("TID", sizeof(struct tid_bitmap_part),
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0);
 	ksegrp_zone = uma_zcreate("KSEGRP", sched_sizeof_ksegrp(),
-	    NULL, NULL, ksegrp_init, NULL,
+	    ksegrp_ctor, NULL, ksegrp_init, NULL,
 	    UMA_ALIGN_CACHE, 0);
 	upcall_zone = uma_zcreate("UPCALL", sizeof(struct kse_upcall),
 	    NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0);
@@ -1320,7 +1335,6 @@
 	td->td_proc     = p;
 	td->td_ksegrp   = kg;
 	td->td_flags    = 0;
-	sched_newthread(td);
 
 	LIST_INIT(&td->td_contested);
 	callout_init(&td->td_slpcallout, CALLOUT_MPSAFE);
@@ -1442,6 +1456,7 @@
 	bcopy(&td->td_startcopy, &td2->td_startcopy,
 	    (unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy));
 	thread_link(td2, ku->ku_ksegrp);
+	sched_newthread(td2);
 	/* inherit blocked thread's context */
 	cpu_set_upcall(td2, td);
 	/* Let the new thread become owner of the upcall */


More information about the p4-projects mailing list