[Monetdb-developers] [Monetdb-checkins] MonetDB/src/gdk gdk_posix.mx, Feb2010, 1.176.2.14, 1.176.2.15

Stefan Manegold Stefan.Manegold at cwi.nl
Mon Feb 15 09:38:36 CET 2010


On Sun, Feb 14, 2010 at 09:23:10PM +0000, Martin Kersten wrote:
> Update of /cvsroot/monetdb/MonetDB/src/gdk
> In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28118
> 
> Modified Files:
>       Tag: Feb2010
> 	gdk_posix.mx 
> Log Message:
> Move the load advice outside the lock. 

FYI:
This checkin also changes the semantics of MT_mmap_inform() such that, now,
(1) with preload > 0, posix_madvise(base, len, advise) is also called on
    areas that are not maintained in MT_mmap_tab[]
(2) with preload < 0, posix_madvise(base, len, BUF_NORMAL) is never called
    on areas that are not maintained in MT_mmap_tab[]

Was this intended?

Stefan

> 
> Index: gdk_posix.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_posix.mx,v
> retrieving revision 1.176.2.14
> retrieving revision 1.176.2.15
> diff -u -d -r1.176.2.14 -r1.176.2.15
> --- gdk_posix.mx	14 Feb 2010 13:17:50 -0000	1.176.2.14
> +++ gdk_posix.mx	14 Feb 2010 21:22:29 -0000	1.176.2.15
> @@ -884,7 +884,7 @@
>  void
>  MT_mmap_inform(void *base, size_t len, int preload, int advise, int writable)
>  {
> -	int i;
> +	int i, unload =0;
>  
>  	(void) pthread_mutex_lock(&MT_mmap_lock);
>  	i = MT_mmap_idx(base, len);
> @@ -892,12 +892,13 @@
>  		if (writable) MT_mmap_tab[i].writable = (writable > 0);
>  		MT_mmap_tab[i].random += preload * (advise == BUF_WILLNEED); /* done as a counter to keep track of multiple threads */
>  		MT_mmap_tab[i].usecnt += preload; /* active thread count */
> -		if (preload > 0) 
> -			(void) posix_madvise(base, len, advise);
> -		else if (MT_mmap_tab[i].usecnt == 0) 
> -			(void) posix_madvise(base, len, BUF_NORMAL);
> +		unload = MT_mmap_tab[i].usecnt == 0;
>  	}
>  	(void) pthread_mutex_unlock(&MT_mmap_lock);
> +	if (preload > 0) 
> +		(void) posix_madvise(base, len, advise);
> +	else if (unload)
> +		(void) posix_madvise(base, len, BUF_NORMAL);
>  
>  }
>  
> 
> 
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Monetdb-checkins mailing list
> Monetdb-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4199       |




More information about the developers-list mailing list