Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jan 1997 21:19:06 +1100 (EST)
From:      Douglas Thomas Crosher  <dtc@scrooge.ee.swin.oz.au>
To:        current@freebsd.org
Subject:   possible madvise MADV_FREE improvement
Message-ID:  <199701191019.VAA09832@scrooge.ee.swin.oz.au>

next in thread | raw e-mail | index | archive | help

Below is a patch which seems to improve madvise MADV_FREE; stops the
page-ins in the example recently posted.  It also brings the call
closer to reliably zeroing the pages.

Regards
Douglas Crosher

-=-=-

*** vm_object.c.1	Thu Jan 16 16:12:54 1997
--- vm_object.c	Sun Jan 19 21:05:45 1997
***************
*** 697,702 ****
--- 697,703 ----
  {
  	vm_pindex_t end;
  	vm_page_t m;
+ 	int s;
  
  	if (object == NULL)
  		return;
***************
*** 714,721 ****
  		if (m == NULL || m->busy || (m->flags & PG_BUSY) ||
  			m->hold_count || m->wire_count ||
  			m->valid != VM_PAGE_BITS_ALL)
! 			continue;
! 
  		if (advise == MADV_WILLNEED) {
  			if (m->queue != PQ_ACTIVE)
  				vm_page_activate(m);
--- 715,736 ----
  		if (m == NULL || m->busy || (m->flags & PG_BUSY) ||
  			m->hold_count || m->wire_count ||
  			m->valid != VM_PAGE_BITS_ALL)
! 		  {
! 		    if ( (advise!=MADV_FREE) ||
! 			 ((object->type != OBJT_DEFAULT) &&
! 			  (object->type != OBJT_SWAP)) )
! 		      continue;
! 		    else if (m == NULL) {
! 		      swap_pager_dmzspace(object, pindex, 1);
! 		      continue;
! 		    } else if ( m->busy || (m->flags & PG_BUSY) ) {
! 		      s = splvm();
! 		      m->flags |= PG_WANTED;
! 		      tsleep(m, PVM, "mafree", 0);
! 		      splx(s);
! 		    }
! 		  }
! 		
  		if (advise == MADV_WILLNEED) {
  			if (m->queue != PQ_ACTIVE)
  				vm_page_activate(m);



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