Re: [Monetdb-developers] [Monetdb-checkins] MonetDB/src/gdk gdk_posix.mx, Feb2010, 1.176.2.14, 1.176.2.15
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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- | 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 |
Stefan Manegold wrote:
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[] Indeed. There is no reason at this moment to bind it exclusively to 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[] should be indeed. But more experimentation is needed to separate the role of MT_mmap_tab and general posix advice.
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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
participants (2)
-
Martin Kersten
-
Stefan Manegold