mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
warn about lock just once
This commit is contained in:
parent
80e063c6bc
commit
f42da492f9
4 changed files with 36 additions and 19 deletions
|
|
@ -87,6 +87,7 @@ struct globals {
|
|||
};
|
||||
|
||||
static struct globals globals;
|
||||
static bool mlock_warned = false;
|
||||
|
||||
#define OBJECT_CHUNK 8
|
||||
|
||||
|
|
@ -1801,11 +1802,14 @@ static int client_node_port_use_buffers(void *object,
|
|||
pw_log_warn("unknown buffer data type %d", d->type);
|
||||
}
|
||||
if (c->allow_mlock && mlock(d->data, d->maxsize) < 0) {
|
||||
pw_log_warn(NAME" %p: Failed to mlock memory %p %u: %s", c,
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#define MAX_IO 32
|
||||
|
||||
/** \cond */
|
||||
static bool mlock_warned = false;
|
||||
|
||||
struct buffer {
|
||||
uint32_t id;
|
||||
|
|
@ -645,12 +646,15 @@ client_node_port_use_buffers(void *object,
|
|||
bid->mem = mm;
|
||||
|
||||
if (data->allow_mlock && mlock(mm->ptr, mm->size) < 0)
|
||||
pw_log(data->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||
"Failed to mlock memory %p %u: %s",
|
||||
mm->ptr, mm->size,
|
||||
errno == ENOMEM ?
|
||||
"This is not a problem but for best performance, "
|
||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||
if (errno != ENOMEM || !mlock_warned) {
|
||||
pw_log(data->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||
"Failed to mlock memory %p %u: %s",
|
||||
mm->ptr, mm->size,
|
||||
errno == ENOMEM ?
|
||||
"This is not a problem but for best performance, "
|
||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||
mlock_warned |= errno == ENOMEM;
|
||||
}
|
||||
|
||||
size = sizeof(struct spa_buffer);
|
||||
for (j = 0; j < buffers[i].buffer->n_metas; j++)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#define MAX_PORTS 1024
|
||||
|
||||
static float empty[MAX_SAMPLES];
|
||||
static bool mlock_warned = false;
|
||||
|
||||
struct buffer {
|
||||
struct pw_buffer this;
|
||||
|
|
@ -555,12 +556,15 @@ static int map_data(struct filter *impl, struct spa_data *data, int prot)
|
|||
range.offset, range.size, data->data);
|
||||
|
||||
if (impl->allow_mlock && mlock(data->data, data->maxsize) < 0) {
|
||||
pw_log(impl->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
||||
data->data, data->maxsize,
|
||||
errno == ENOMEM ?
|
||||
"This is not a problem but for best performance, "
|
||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||
if (errno != ENOMEM || !mlock_warned) {
|
||||
pw_log(impl->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
||||
data->data, data->maxsize,
|
||||
errno == ENOMEM ?
|
||||
"This is not a problem but for best performance, "
|
||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||
mlock_warned |= errno == ENOMEM;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@
|
|||
#define MASK_BUFFERS (MAX_BUFFERS-1)
|
||||
#define MAX_PORTS 1
|
||||
|
||||
static bool mlock_warned = false;
|
||||
|
||||
struct buffer {
|
||||
struct pw_buffer this;
|
||||
uint32_t id;
|
||||
|
|
@ -561,12 +563,15 @@ static int map_data(struct stream *impl, struct spa_data *data, int prot)
|
|||
range.offset, range.size, data->data);
|
||||
|
||||
if (impl->allow_mlock && mlock(data->data, data->maxsize) < 0) {
|
||||
pw_log(impl->process_rt ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
||||
data->data, data->maxsize,
|
||||
errno == ENOMEM ?
|
||||
"This is not a problem but for best performance, "
|
||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||
if (errno != ENOMEM || !mlock_warned) {
|
||||
pw_log(impl->process_rt ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
||||
data->data, data->maxsize,
|
||||
errno == ENOMEM ?
|
||||
"This is not a problem but for best performance, "
|
||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||
mlock_warned |= errno == ENOMEM;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue