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 struct globals globals;
|
||||||
|
static bool mlock_warned = false;
|
||||||
|
|
||||||
#define OBJECT_CHUNK 8
|
#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);
|
pw_log_warn("unknown buffer data type %d", d->type);
|
||||||
}
|
}
|
||||||
if (c->allow_mlock && mlock(d->data, d->maxsize) < 0) {
|
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,
|
d->data, d->maxsize,
|
||||||
errno == ENOMEM ?
|
errno == ENOMEM ?
|
||||||
"This is not a problem but for best performance, "
|
"This is not a problem but for best performance, "
|
||||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||||
|
mlock_warned |= errno == ENOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT);
|
SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT);
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
#define MAX_IO 32
|
#define MAX_IO 32
|
||||||
|
|
||||||
/** \cond */
|
/** \cond */
|
||||||
|
static bool mlock_warned = false;
|
||||||
|
|
||||||
struct buffer {
|
struct buffer {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
@ -645,12 +646,15 @@ client_node_port_use_buffers(void *object,
|
||||||
bid->mem = mm;
|
bid->mem = mm;
|
||||||
|
|
||||||
if (data->allow_mlock && mlock(mm->ptr, mm->size) < 0)
|
if (data->allow_mlock && mlock(mm->ptr, mm->size) < 0)
|
||||||
pw_log(data->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
if (errno != ENOMEM || !mlock_warned) {
|
||||||
"Failed to mlock memory %p %u: %s",
|
pw_log(data->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||||
mm->ptr, mm->size,
|
"Failed to mlock memory %p %u: %s",
|
||||||
errno == ENOMEM ?
|
mm->ptr, mm->size,
|
||||||
"This is not a problem but for best performance, "
|
errno == ENOMEM ?
|
||||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
"This is not a problem but for best performance, "
|
||||||
|
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||||
|
mlock_warned |= errno == ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
size = sizeof(struct spa_buffer);
|
size = sizeof(struct spa_buffer);
|
||||||
for (j = 0; j < buffers[i].buffer->n_metas; j++)
|
for (j = 0; j < buffers[i].buffer->n_metas; j++)
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
#define MAX_PORTS 1024
|
#define MAX_PORTS 1024
|
||||||
|
|
||||||
static float empty[MAX_SAMPLES];
|
static float empty[MAX_SAMPLES];
|
||||||
|
static bool mlock_warned = false;
|
||||||
|
|
||||||
struct buffer {
|
struct buffer {
|
||||||
struct pw_buffer this;
|
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);
|
range.offset, range.size, data->data);
|
||||||
|
|
||||||
if (impl->allow_mlock && mlock(data->data, data->maxsize) < 0) {
|
if (impl->allow_mlock && mlock(data->data, data->maxsize) < 0) {
|
||||||
pw_log(impl->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
if (errno != ENOMEM || !mlock_warned) {
|
||||||
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
pw_log(impl->warn_mlock ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||||
data->data, data->maxsize,
|
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
||||||
errno == ENOMEM ?
|
data->data, data->maxsize,
|
||||||
"This is not a problem but for best performance, "
|
errno == ENOMEM ?
|
||||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
"This is not a problem but for best performance, "
|
||||||
|
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||||
|
mlock_warned |= errno == ENOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@
|
||||||
#define MASK_BUFFERS (MAX_BUFFERS-1)
|
#define MASK_BUFFERS (MAX_BUFFERS-1)
|
||||||
#define MAX_PORTS 1
|
#define MAX_PORTS 1
|
||||||
|
|
||||||
|
static bool mlock_warned = false;
|
||||||
|
|
||||||
struct buffer {
|
struct buffer {
|
||||||
struct pw_buffer this;
|
struct pw_buffer this;
|
||||||
uint32_t id;
|
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);
|
range.offset, range.size, data->data);
|
||||||
|
|
||||||
if (impl->allow_mlock && mlock(data->data, data->maxsize) < 0) {
|
if (impl->allow_mlock && mlock(data->data, data->maxsize) < 0) {
|
||||||
pw_log(impl->process_rt ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
if (errno != ENOMEM || !mlock_warned) {
|
||||||
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
pw_log(impl->process_rt ? SPA_LOG_LEVEL_WARN : SPA_LOG_LEVEL_DEBUG,
|
||||||
data->data, data->maxsize,
|
NAME" %p: Failed to mlock memory %p %u: %s", impl,
|
||||||
errno == ENOMEM ?
|
data->data, data->maxsize,
|
||||||
"This is not a problem but for best performance, "
|
errno == ENOMEM ?
|
||||||
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
"This is not a problem but for best performance, "
|
||||||
|
"consider increasing RLIMIT_MEMLOCK" : strerror(errno));
|
||||||
|
mlock_warned |= errno == ENOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue