Changeset: ed2de4b786d9 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed2de4b786d9 Modified Files: gdk/gdk_bbp.c Branch: Oct2014 Log Message:
Limit the time it takes to find a long free list. See the changed comment in the code. diffs (57 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -1703,24 +1703,28 @@ BBPcurstamp(void) } /* There are BBP_THREADMASK+1 (64) free lists, and ours (idx) is - * empty. Here we find the longest free list, and if it is long - * enough (> 20 entries) we take one entry from that list. If the - * longest list isn't long enough, we create a new entry by either - * just increasing BBPsize (up to BBPlimit) or extending the BBP - * (which increases BBPlimit). */ + * empty. Here we find a longish free list (at least 20 entries), and + * if we can find one, we take one entry from that list. If no long + * enough list can be found, we create a new entry by either just + * increasing BBPsize (up to BBPlimit) or extending the BBP (which + * increases BBPlimit). Every time this function is called we start + * searching in a following free list (variable "last"). */ static void maybeextend(int idx) { int t, m; int n, l; bat i; + static int last = 0; l = 0; /* length of longest list */ m = 0; /* index of longest list */ - /* find longest free list */ - for (t = 0; t <= BBP_THREADMASK; t++) { + /* find a longish free list */ + for (t = 0; t <= BBP_THREADMASK && l <= 20; t++) { n = 0; - for (i = BBP_free(t); i != 0; i = BBP_next(i)) + for (i = BBP_free((t + last) & BBP_THREADMASK); + i != 0 && n <= 20; + i = BBP_next(i)) n++; if (n > l) { m = t; @@ -1728,7 +1732,7 @@ maybeextend(int idx) } } if (l > 20) { - /* longest list is long enough, get an entry from there */ + /* list is long enough, get an entry from there */ i = BBP_free(m); BBP_free(m) = BBP_next(i); BBP_next(i) = 0; @@ -1741,6 +1745,7 @@ maybeextend(int idx) BBP_free(idx) = (bat) ATOMIC_GET(BBPsize, BBPsizeLock, "BBPinsert") - 1; } } + last = (last + 1) & BBP_THREADMASK; } bat _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list