Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Sep 2004 19:49:34 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 61257 for review
Message-ID:  <200409091949.i89JnY2x024018@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=61257

Change 61257 by jhb@jhb_slimer on 2004/09/09 19:48:37

	Minor nits I noticed while looking in here:
	- Just use sched_prio() directly rather than taking the long detour
	  through the rtprio crap.
	- Only switch away if there is another runnable thread, switching
	  away when there isn't is just stupid as we end up switching right
	  back to ourselves which only serves to waste time.

Affected files ...

.. //depot/projects/smpng/sys/vm/vm_zeroidle.c#19 edit

Differences ...

==== //depot/projects/smpng/sys/vm/vm_zeroidle.c#19 (text+ko) ====

@@ -138,36 +138,28 @@
 vm_pagezero(void __unused *arg)
 {
 	struct proc *p;
-	struct rtprio rtp;
 	struct thread *td;
-	int pages, pri;
 
 	td = curthread;
 	p = td->td_proc;
-	rtp.prio = RTP_PRIO_MAX;
-	rtp.type = RTP_PRIO_IDLE;
-	pages = 0;
 	mtx_lock_spin(&sched_lock);
-	rtp_to_pri(&rtp, td->td_ksegrp);
-	pri = td->td_priority;
+	sched_prio(td, PRI_MAX_IDLE);
 	mtx_unlock_spin(&sched_lock);
 	idlezero_enable = idlezero_enable_default;
 
 	for (;;) {
 		if (vm_page_zero_check()) {
-			pages += vm_page_zero_idle();
+			vm_page_zero_idle();
 #ifndef PREEMPTION
-			if (pages > idlezero_maxrun || sched_runnable()) {
+			if (sched_runnable()) {
 				mtx_lock_spin(&sched_lock);
 				mi_switch(SW_VOL, NULL);
 				mtx_unlock_spin(&sched_lock);
-				pages = 0;
 			}
 #endif
-		} else {
-			tsleep(&zero_state, pri, "pgzero", hz * 300);
-			pages = 0;
-		}
+		} else
+			tsleep(&zero_state, td->td_priority, "pgzero",
+			    hz * 300);
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409091949.i89JnY2x024018>