PERFORCE change 58031 for review

Julian Elischer julian at FreeBSD.org
Sat Jul 24 02:24:04 PDT 2004


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

Change 58031 by julian at julian_ref on 2004/07/24 09:23:10

	Simplify spare allocation a bit. 
	We don't need that second argumant.

Affected files ...

.. //depot/projects/nsched/sys/kern/kern_kse.c#20 edit

Differences ...

==== //depot/projects/nsched/sys/kern/kern_kse.c#20 (text+ko) ====

@@ -66,7 +66,7 @@
 	TAILQ_HEAD_INITIALIZER(zombie_upcalls);
 
 static int thread_update_usr_ticks(struct thread *td, int user);
-static void thread_alloc_spare(struct thread *td, struct thread *spare);
+static void thread_alloc_spare(struct thread *td);
 
 struct kse_upcall *
 upcall_alloc(void)
@@ -576,7 +576,7 @@
 
 	/* For the first call this may not have been set */
 	if (td->td_standin == NULL)
-		thread_alloc_spare(td, NULL);
+		thread_alloc_spare(td);
 
 	PROC_LOCK(p);
 	if (newkg->kg_numupcalls >= ncpus) {
@@ -894,17 +894,12 @@
  * for thread_schedule_upcall().
  */
 void
-thread_alloc_spare(struct thread *td, struct thread *spare)
+thread_alloc_spare(struct thread *td)
 {
-
 	if (td->td_standin)
 		return;
-	if (spare == NULL) {
-		spare = thread_alloc();
-	}
-	sched_init_thread(spare);
-	td->td_standin = spare;
-	bzero(&spare->td_startzero,
+	td->td_standin = thread_alloc();
+	bzero(&td->td_spare->td_startzero,
 	    (unsigned)RANGEOF(struct thread, td_startzero, td_endzero));
 	spare->td_proc = td->td_proc;
 	spare->td_ucred = crhold(td->td_ucred);
@@ -1061,7 +1056,7 @@
 		td->td_mailbox = NULL;
 	} else {
 		if (td->td_standin == NULL)
-			thread_alloc_spare(td, NULL);
+			thread_alloc_spare(td);
 		flags = fuword32(&tmbx->tm_flags);
 		/*
 		 * On some architectures, TP register points to thread
@@ -1288,7 +1283,7 @@
 		 * for when we re-enter the kernel.
 		 */
 		if (td->td_standin == NULL)
-			thread_alloc_spare(td, NULL);
+			thread_alloc_spare(td);
 	}
 
 	ku->ku_mflags = 0;


More information about the p4-projects mailing list