1
0
mirror of https://github.com/schoebel/mars synced 2025-04-01 22:58:34 +00:00

main: improve prosumer preallocation

This commit is contained in:
Thomas Schoebel-Theuer 2023-10-05 09:24:10 +02:00
parent f0304dd7cd
commit aba543090f
2 changed files with 7 additions and 4 deletions

View File

@ -740,9 +740,6 @@ void set_brick_mem_freelist_max(int max, int order)
{ {
if (max > brick_mem_freelist_max[order]) { if (max > brick_mem_freelist_max[order]) {
brick_mem_freelist_max[order] = max; brick_mem_freelist_max[order] = max;
} else if (max < brick_mem_freelist_max[order] / 2 &&
brick_mem_freelist_max[order] > 0) {
brick_mem_freelist_max[order]--;
} }
} }
#else #else

View File

@ -254,6 +254,8 @@ void _crashme(int mode, bool do_sync)
int nr_affected_resources; int nr_affected_resources;
int tmp_nr_affected_resources; int tmp_nr_affected_resources;
int nr_prosumer_resources;
int tmp_nr_prosumer_resources;
void update_brick_mem_freelist_max(void) void update_brick_mem_freelist_max(void)
{ {
@ -264,7 +266,8 @@ void update_brick_mem_freelist_max(void)
int max = 0; int max = 0;
if (order == MARS_MEMRESERVE_ORDER) { if (order == MARS_MEMRESERVE_ORDER) {
max = nr_affected_resources * MEMRESERVE_FACTOR_5; max = nr_affected_resources + nr_prosumer_resources;
max *= MEMRESERVE_FACTOR_5;
} }
set_brick_mem_freelist_max(max, order); set_brick_mem_freelist_max(max, order);
} }
@ -6215,6 +6218,7 @@ int make_dev(struct mars_dent *dent)
MARS_DBG("nothing to do\n"); MARS_DBG("nothing to do\n");
goto err; goto err;
} }
tmp_nr_prosumer_resources++;
if (!rot->trans_brick) { if (!rot->trans_brick) {
MARS_DBG("transaction logger does not exist\n"); MARS_DBG("transaction logger does not exist\n");
goto done; goto done;
@ -7569,6 +7573,8 @@ static int _main_thread(void *data)
/* swizzle indicator */ /* swizzle indicator */
nr_affected_resources = tmp_nr_affected_resources; nr_affected_resources = tmp_nr_affected_resources;
tmp_nr_affected_resources = 0; tmp_nr_affected_resources = 0;
nr_prosumer_resources = tmp_nr_prosumer_resources;
tmp_nr_prosumer_resources = 0;
/* Static memlimit */ /* Static memlimit */
if (mars_mem_percent < 0) if (mars_mem_percent < 0)