[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.1...

Peter Boncz P.Boncz at cwi.nl
Fri Feb 12 20:23:40 CET 2010


It is correct; thanks!!

On Feb 12, 2010, at 20:22, "Stefan Manegold" <Stefan.Manegold at cwi.nl>  
wrote:

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