[Monetdb-developers] [Monetdb-checkins] MonetDB/src/gdk gdk.mx, Feb2010, 1.301.2.9, 1.301.2.10 gdk_bat.mx, Feb2010, 1.236.2.4, 1.236.2.5 gdk_batop.mx, Feb2010, 1.180.2.15, 1.180.2.16 gdk_bbp.mx, Feb2010, 1.269.2.5, 1.269.2.6 gdk_posix.mx, Feb2010, 1.176.2.11, 1.176.2.12 gdk_relop.mx, Feb2010, 1.179.2.13, 1.179.2.14 gdk_storage.mx, Feb2010, 1.149.2.21, 1.149.2.22 gdk_utils.mx, Feb2010, 1.262.2.10, 1.262.2.11

Stefan Manegold Stefan.Manegold at cwi.nl
Fri Feb 12 19:15:52 CET 2010


Peter,

> +/* a thread informs it is goin to (preload==1) or stops (preload==-1) using a range of memory */
>  void
> -MT_mmap_pin(void *base, size_t len)
> +MT_mmap_inform(void *base, size_t len, int preload, int advise, int writable)
>  {
>  	int i;
>  
>  	(void) pthread_mutex_lock(&MT_mmap_lock);
>  	i = MT_mmap_idx(base, len);
>  	if (i >= 0) {
> -		MT_mmap_tab[i].pincnt++;
> +		if (writable) MT_mmap_tab[i].writable = (writable > 0);
> +		MT_mmap_tab[i].random += (advise == BUF_WILLNEED); /* done as a counter to keep track of multiple threads */
                                         ^^^^^^^^^^^^^^^^^^^^^^^^
shouldn't this rather be something like
		MT_mmap_tab[i].random += preload * (advise == BUF_WILLNEED);
?
Otherwise (i.e., in the current case), both BATpreload_() & _BATpreload()
only increment MT_mmap_tab[i].random, but never decrement it, right?

Stefan

> +		MT_mmap_tab[i].usecnt += preload; /* active thread count */
> +		if (preload > 0) (void) posix_madvise(base, len, advise);
>  	}
>  	(void) pthread_mutex_unlock(&MT_mmap_lock);
>  
>  }

-- 
| 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