Commit bd33cab5 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Only try nuking after we failed to allocate space

parent 62c3d562
......@@ -531,12 +531,7 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
ltot = sizeof(struct object) + PRNDUP(wsl);
ltot = IRNUP(sc, ltot);
while (1) {
if (nuke_limit > 0) {
if (!LRU_NukeOne(wrk, stv->lru))
return (0);
nuke_limit--;
}
for (; nuke_limit >= 0; nuke_limit--) {
st = smp_allocx(stv, ltot, ltot, &so, &objidx, &sg);
if (st != NULL && st->space < ltot) {
stv->sml_free(st); // NOP
......@@ -544,7 +539,7 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
}
if (st != NULL)
break;
if (!nuke_limit)
if (!nuke_limit || !LRU_NukeOne(wrk, stv->lru))
return (0);
}
......
......@@ -141,12 +141,7 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv,
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
assert(nuke_limit >= 0);
ltot = sizeof(struct object) + PRNDUP(wsl);
while (1) {
if (nuke_limit > 0) {
if (!LRU_NukeOne(wrk, stv->lru))
return (0);
nuke_limit--;
}
for (; nuke_limit >= 0; nuke_limit--) {
AN(stv->sml_alloc);
st = stv->sml_alloc(stv, ltot);
if (st != NULL && st->space < ltot) {
......@@ -155,7 +150,7 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv,
}
if (st != NULL)
break;
if (!nuke_limit)
if (!nuke_limit || !LRU_NukeOne(wrk, stv->lru))
return (0);
}
AN(st);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment