Changeset: ad09d4c7ae69 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ad09d4c7ae69
Modified Files:
        gdk/gdk_bbp.c
Branch: Jun2023
Log Message:

Don't try to trim too much under heavy load when there is nothing left to trim.


diffs (51 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1467,10 +1467,11 @@ movestrbats(void)
 }
 #endif
 
-static void
+static bool
 BBPtrim(bool aggressive)
 {
        int n = 0;
+       bool changed = false;
        unsigned flag = BBPUNLOADING | BBPSYNCING | BBPSAVING;
        if (!aggressive)
                flag |= BBPHOT;
@@ -1501,16 +1502,19 @@ BBPtrim(bool aggressive)
                        if (BBPfree(b) != GDK_SUCCEED)
                                GDKerror("unload failed for bat %d", bid);
                        n++;
+                       changed = true;
                }
                BBPtmunlock();
        }
        TRC_DEBUG(BAT_, "unloaded %d bats%s\n", n, aggressive ? " (also hot)" : 
"");
+       return changed;
 }
 
 static void
 BBPmanager(void *dummy)
 {
        (void) dummy;
+       bool changed = true;
 
        for (;;) {
                int n = 0;
@@ -1524,12 +1528,12 @@ BBPmanager(void *dummy)
                }
                TRC_DEBUG(BAT_, "cleared HOT bit from %d bats\n", n);
                size_t cur = GDKvm_cursize();
-               for (int i = 0, n = cur > GDK_vm_maxsize / 2 ? 1 : cur > 
GDK_vm_maxsize / 4 ? 10 : 100; i < n; i++) {
+               for (int i = 0, n = changed && cur > GDK_vm_maxsize / 2 ? 1 : 
cur > GDK_vm_maxsize / 4 ? 10 : 100; i < n; i++) {
                        MT_sleep_ms(100);
                        if (GDKexiting())
                                return;
                }
-               BBPtrim(false);
+               changed = BBPtrim(false);
                BBPcallbacks();
                if (GDKexiting())
                        return;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to