It is correct; thanks!!
On Feb 12, 2010, at 20:22, "Stefan Manegold"
On Fri, Feb 12, 2010 at 07:15:52PM +0100, Stefan Manegold wrote:
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);
I just checked this in --- hope it's indeed correct ...
Stefan
? 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@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 |