Changeset: 559551b3ef1b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=559551b3ef1b
Modified Files:
monetdb5/mal/mal_resource.c
monetdb5/mal/mal_resource.h
Branch: default
Log Message:
Simplify resource control
Reduce the waiting time to just a few milliseconds when needed.
Simplify the delay punishment calculations.
diffs (59 lines):
diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c
--- a/monetdb5/mal/mal_resource.c
+++ b/monetdb5/mal/mal_resource.c
@@ -186,7 +186,6 @@ MALresourceFairness(Client cntxt, MalBlk
unsigned int delay;
lng clk;
int threads;
- double factor;
int delayed= 0;
#ifdef ATOMIC_LOCK
#ifdef NEED_MT_LOCK_INIT
@@ -221,27 +220,26 @@ MALresourceFairness(Client cntxt, MalBlk
if ( clk > DELAYUNIT ) {
PARDEBUG mnstr_printf(GDKstdout, "#delay %d initial "LLFMT"n",
cntxt->idx, clk);
+ ATOMIC_DEC_int(running, runningLock, "MALresourceFairness");
while (clk > 0) {
- /* always keep one running to avoid all waiting */
- if (ATOMIC_GET_int(running, runningLock,
"MALresourceFairness") < 2)
- break;
/* speed up wake up when we have memory */
- rss = GDKmem_cursize();
if (rss < MEMORY_THRESHOLD * monet_memory)
break;
- factor = ((double) rss) / (MEMORY_THRESHOLD *
monet_memory);
- delay = (unsigned int) (DELAYUNIT * (factor > 1.0 ? 1.0
: factor));
- delay = (unsigned int) ( ((double)delay) *
ATOMIC_GET_int(running, runningLock, "MALresourceFairness") / threads);
- ATOMIC_DEC_int(running, runningLock,
"MALresourceFairness");
+ /* always keep one running to avoid all waiting */
+ if ( running < 2) /* dirty read of shared variable is
safe here */
+ //if ( (r =ATOMIC_GET_int(running, runningLock,
"MALresourceFairness")) < 2)
+ break;
+ delay = (unsigned int) ( ((double)DELAYUNIT * running)
/ threads);
if (delay) {
if ( delayed++ == 0){
mnstr_printf(GDKstdout, "#delay
%d initial %u["LLFMT"] memory "SZFMT"[%f]\n", cntxt->idx, delay, clk, rss,
MEMORY_THRESHOLD * monet_memory);
mnstr_flush(GDKstdout);
}
MT_sleep_ms(delay);
+ rss = GDKmem_cursize();
}
- ATOMIC_INC_int(running, runningLock,
"MALresourceFairness");
clk -= DELAYUNIT;
}
+ ATOMIC_INC_int(running, runningLock, "MALresourceFairness");
}
}
diff --git a/monetdb5/mal/mal_resource.h b/monetdb5/mal/mal_resource.h
--- a/monetdb5/mal/mal_resource.h
+++ b/monetdb5/mal/mal_resource.h
@@ -23,7 +23,7 @@
#include "mal_interpreter.h"
#define TIMESLICE 2000 /* ms */
-#define DELAYUNIT 100 /* ms delay in parallel processing decissions */
+#define DELAYUNIT 5 /* ms delay in parallel processing decisions */
#define USE_MAL_ADMISSION
#ifdef USE_MAL_ADMISSION
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list