Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 2000 23:12:13 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Takaya Ogawa <t-ogawa@triaez.kaisei.org>
Cc:        current@FreeBSD.ORG, jasone@FreeBSD.ORG
Subject:   Re: new idle_proc() makes my laptop very hot
Message-ID:  <Pine.BSF.4.21.0009222300550.6475-100000@besplex.bde.org>
In-Reply-To: <867l85y9sr.wl@triaez.kaisei.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 22 Sep 2000, Takaya Ogawa wrote:

> Attached patch adds back the HLT in i386 UP case and
> seems to fix my problem, although I'm totally
> unfamiliar with SMP nor alpha.

This has the race bug that was fixed in rev.1.88 of swtch.s.

I use the folowing fix.  It also fixes the loss of page cleaning in the
idle routine.  It hasn't been committed mainly because idle page cleaning
hasn't been tested for the SMP case or implemented for alphas (the alpha's
vm_page_zero_idle() has apparently never been used).

Most of the #include changes are unrelated.  They are wrong fixes for spam
in <machine/globaldata.h>.

diff -c2 kern_idle.c~ kern_idle.c
*** kern_idle.c~	Sun Sep 17 04:27:14 2000
--- kern_idle.c	Sun Sep 17 23:07:41 2000
***************
*** 29,34 ****
  #include <machine/ipl.h>
  #include <machine/mutex.h>
- #include <machine/smp.h>
  
  #include <machine/globaldata.h>
  #include <machine/globals.h>
--- 29,41 ----
  #include <machine/ipl.h>
  #include <machine/mutex.h>
  
+ #ifdef __i386__ /* XXX */
+ #ifdef SMP
+ #include <vm/pmap.h>
+ #endif
+ #include <machine/md_var.h>
+ #include <machine/segments.h>
+ #include <machine/tss.h>
+ #endif
  #include <machine/globaldata.h>
  #include <machine/globals.h>
***************
*** 40,43 ****
--- 47,52 ----
  #endif
  
+ extern void (*_hlt_vector)(void);
+ 
  static void idle_setup(void *dummy);
  SYSINIT(idle_setup, SI_SUB_SCHED_IDLE, SI_ORDER_FIRST, idle_setup, NULL)
***************
*** 84,88 ****
--- 93,107 ----
  		count = 0;
  
+ #ifdef __i386__
+ 		disable_intr();
+ #endif
  		while (count >= 0 && procrunnable() == 0) {
+ #ifdef __i386__
+ 			if (vm_page_zero_idle() != 0)
+ 				continue;
+ 			(*_hlt_vector)();
+ 			disable_intr();
+ 			continue;
+ #endif
  		/*
  		 * This is a good place to put things to be done in
***************
*** 93,96 ****
--- 112,118 ----
  				    " for a process");
  		}
+ #ifdef __i386__
+ 		enable_intr();
+ #endif
  
  		mtx_enter(&sched_lock, MTX_SPIN);



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009222300550.6475-100000>