remove mlock and use MAP_LOCKED

The warnings are confusing and a properly tuned system would have
the limits set correctly.
This commit is contained in:
Wim Taymans 2021-01-19 11:59:21 +01:00
parent 89641785c3
commit ab91e94b59
4 changed files with 21 additions and 64 deletions

View file

@ -87,7 +87,6 @@ struct globals {
};
static struct globals globals;
static bool mlock_warned = false;
#define OBJECT_CHUNK 8
@ -1723,6 +1722,8 @@ static int client_node_port_use_buffers(void *object,
/* some apps write to the input buffer so we want everything readwrite */
fl = PW_MEMMAP_FLAG_READWRITE;
}
if (c->allow_mlock)
fl |= PW_MEMMAP_FLAG_LOCKED;
/* clear previous buffers */
clear_buffers(c, mix);
@ -1805,16 +1806,6 @@ static int client_node_port_use_buffers(void *object,
} else {
pw_log_warn("unknown buffer data type %d", d->type);
}
if (c->allow_mlock && mlock(d->data, d->maxsize) < 0) {
if (errno != ENOMEM || !mlock_warned) {
pw_log_warn(NAME" %p: Failed to mlock memory %p %u: %s", c,
d->data, d->maxsize,
errno == ENOMEM ?
"This is not a problem but for best performance, "
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
mlock_warned |= errno == ENOMEM;
}
}
}
SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT);
if (direction == SPA_DIRECTION_OUTPUT)