Needed for the future post-copy live migration support for
vhost-user ports.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
/* --version option output. */
static char *program_version;
/* --version option output. */
static char *program_version;
+/* 'true' if mlockall() succeeded. */
+static bool is_memory_locked = false;
+
/* Buffer used by ovs_strerror() and ovs_format_message(). */
DEFINE_STATIC_PER_THREAD_DATA(struct { char s[128]; },
strerror_buffer,
/* Buffer used by ovs_strerror() and ovs_format_message(). */
DEFINE_STATIC_PER_THREAD_DATA(struct { char s[128]; },
strerror_buffer,
+void
+set_memory_locked(void)
+{
+ is_memory_locked = true;
+}
+
+bool
+memory_locked(void)
+{
+ return is_memory_locked;
+}
+
void
out_of_memory(void)
{
void
out_of_memory(void)
{
void ovs_print_version(uint8_t min_ofp, uint8_t max_ofp);
void ovs_print_version(uint8_t min_ofp, uint8_t max_ofp);
+void set_memory_locked(void);
+bool memory_locked(void);
+
OVS_NO_RETURN void out_of_memory(void);
void *xmalloc(size_t) MALLOC_LIKE;
void *xcalloc(size_t, size_t) MALLOC_LIKE;
OVS_NO_RETURN void out_of_memory(void);
void *xmalloc(size_t) MALLOC_LIKE;
void *xcalloc(size_t, size_t) MALLOC_LIKE;
#ifdef HAVE_MLOCKALL
if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
VLOG_ERR("mlockall failed: %s", ovs_strerror(errno));
#ifdef HAVE_MLOCKALL
if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
VLOG_ERR("mlockall failed: %s", ovs_strerror(errno));
+ } else {
+ set_memory_locked();
}
#else
VLOG_ERR("mlockall not supported on this system");
}
#else
VLOG_ERR("mlockall not supported on this system");