Commit d08ea98b authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: always compile uffd.c

If CONFIG_HAS_UFFD is not defined an attempt to run the lazy pages daemon
will result in error message
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 34693cb4
......@@ -92,9 +92,7 @@ obj-$(CONFIG_COMPAT) += vdso-compat.o
CFLAGS_REMOVE_vdso-compat.o += $(CFLAGS-ASAN) $(CFLAGS-GCOV)
endif
ifeq ($(UFFD),1)
obj-y += uffd.o
endif
PROTOBUF_GEN := scripts/protobuf-gen.sh
......
......@@ -279,9 +279,7 @@ int main(int argc, char *argv[], char *envp[])
{ "timeout", required_argument, 0, 1072 },
{ "external", required_argument, 0, 1073 },
{ "empty-ns", required_argument, 0, 1074 },
#ifdef CONFIG_HAS_UFFD
{ "lazy-pages", no_argument, 0, 1076 },
#endif
BOOL_OPT("extra", &opts.check_extra_features),
BOOL_OPT("experimental", &opts.check_experimental_features),
{ "all", no_argument, 0, 1079 },
......@@ -522,11 +520,9 @@ int main(int argc, char *argv[], char *envp[])
case 1072:
opts.timeout = atoi(optarg);
break;
#ifdef CONFIG_HAS_UFFD
case 1076:
opts.lazy_pages = true;
break;
#endif
case 'M':
{
char *aux;
......@@ -777,9 +773,7 @@ usage:
" criu page-server\n"
" criu service [<options>]\n"
" criu dedup\n"
#ifdef CONFIG_HAS_UFFD
" criu lazy-pages -D DIR [<options>]\n"
#endif
"\n"
"Commands:\n"
" dump checkpoint a process/tree identified by pid\n"
......@@ -823,12 +817,10 @@ usage:
" restore making it the parent of the restored process\n"
" --freeze-cgroup use cgroup freezer to collect processes\n"
" --weak-sysctls skip restoring sysctls that are not available\n"
#ifdef CONFIG_HAS_UFFD
" --lazy-pages restore pages on demand\n"
" this requires running a second instance of criu\n"
" in lazy-pages mode: 'criu lazy-pages -D DIR'\n"
" --lazy-pages and lazy-pages mode require userfaultfd\n"
#endif
"\n"
"* External resources support:\n"
" --external RES dump objects from this list as external resources:\n"
......
......@@ -25,11 +25,7 @@ extern int cr_restore_tasks(void);
extern int convert_to_elf(char *elf_path, int fd_core);
extern int cr_check(void);
extern int cr_dedup(void);
#ifdef CONFIG_HAS_UFFD
extern int cr_lazy_pages(void);
#else
static inline int cr_lazy_pages() { return 0; };
#endif /* CONFIG_HAS_UFFD */
extern int check_add_feature(char *arg);
extern void pr_check_features(const char *offset, const char *sep, int width);
......
......@@ -30,6 +30,8 @@
#include "include/cr_options.h"
#include "xmalloc.h"
#ifdef CONFIG_HAS_UFFD
#undef LOG_PREFIX
#define LOG_PREFIX "lazy-pages: "
......@@ -664,3 +666,13 @@ int cr_lazy_pages()
return handle_requests(uffd);
}
#else /* CONFIG_HAS_UFFD */
int cr_lazy_pages()
{
pr_msg("userfaultfd system call is not supported, cannot start lazy-pages daemon\n");
return -1;
}
#endif /* CONFIG_HAS_UFFD */
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