Changeset: c433be07649c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c433be07649c
Modified Files:
gdk/gdk_posix.c
Branch: Apr2012
Log Message:
Make that MT_mmap_trim actually does something.
The loop never touched the first MT_MMAP_TILE bytes of the memory map,
and if the map was less than twice that number of bytes, it would also
not touch the rest.
diffs (29 lines):
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -502,6 +502,9 @@ MT_mmap_save_tile(int i, size_t tile, st
int t, ret;
size_t len = MIN((size_t) MT_MMAP_TILE, MT_mmap_tab[i].len - tile);
+ if (len == 0)
+ return 0; /* nothing to do */
+
/* save to disk an 128MB tile, and observe how long this takes */
if (err) {
mnstr_printf(err,
@@ -631,9 +634,14 @@ done:
/* first run, walk backwards
until we hit an unsaved
tile */
- for (off = MT_mmap_tab[i].len; off >=
MT_MMAP_TILE; off -= MT_MMAP_TILE)
+ off = MT_mmap_tab[i].len &
~(MT_MMAP_TILE - 1);
+ for (;;) {
if (MT_mmap_save_tile(i, off,
err))
goto bailout;
+ if (off < MT_MMAP_TILE)
+ break;
+ off -= MT_MMAP_TILE;
+ }
} else {
/* save the next tile */
for (off = MT_mmap_tab[i].save_tile;
off + MT_MMAP_TILE < MT_mmap_tab[i].len; off += MT_MMAP_TILE) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list