[CRIU] [PATCH v5 3/5] Try to include userfaultfd with criu (part 1)
Adrian Reber
adrian at lisas.de
Thu Mar 10 07:18:29 PST 2016
On Thu, Mar 10, 2016 at 03:06:06PM +0300, Dmitry Safonov wrote:
> On 03/10/2016 10:39 AM, Adrian Reber wrote:
[...]
> >v5:
> > * split the userfaultfd patch in multiple smaller patches
> > * introduced vma_can_be_lazy() function to check if a page
> > can be handled by uffd
> > * moved uffd related code from cr-restore.c to uffd.c
> > * handle failure to register a memory page of the restored process
> > with userfaultfd
> Hello, Adrian,
> just a small nip from me below:
> >
> >Signed-off-by: Adrian Reber <areber at redhat.com>
> >---
> > criu/Makefile.config | 6 +-
> > criu/Makefile.crtools | 4 +
> > criu/crtools.c | 6 +
> > criu/include/crtools.h | 5 +
> > criu/include/uffd.h | 16 ++
> > criu/uffd.c | 437 ++++++++++++++++++++++++++++++++++++++++++++++
> > scripts/feature-tests.mak | 15 ++
> > 7 files changed, 488 insertions(+), 1 deletion(-)
> > create mode 100644 criu/include/uffd.h
> > create mode 100644 criu/uffd.c
> >
> >diff --git a/criu/Makefile.config b/criu/Makefile.config
> >index aaaca1f..c3841b9 100644
> >--- a/criu/Makefile.config
> >+++ b/criu/Makefile.config
> >@@ -14,8 +14,12 @@ ifeq ($(call pkg-config-check,libselinux),y)
> > DEFINES += -DCONFIG_HAS_SELINUX
> > endif
> >+ifeq ($(call try-cc,$(FEATURE_TEST_UFFD)),y)
> >+ export UFFD := 1
> >+endif
> >+
> Here we try-cc feature test,
> > FEATURES_LIST := TCP_REPAIR PRLIMIT STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
> >- SETPROCTITLE_INIT MEMFD
> >+ SETPROCTITLE_INIT MEMFD UFFD
> and adding it to FEATURES_LIST will compile feature test for CONFIG_HAS_*
> define the second time, which will slowdown makefile processing.
> As we know the result of first try-cc, we may use it (completely untested):
>
> diff --git a/criu/Makefile.config b/criu/Makefile.config
> index c3841b9..56076b6 100644
> --- a/criu/Makefile.config
> +++ b/criu/Makefile.config
> @@ -19,7 +19,7 @@ ifeq ($(call try-cc,$(FEATURE_TEST_UFFD)),y)
> endif
>
> FEATURES_LIST := TCP_REPAIR PRLIMIT STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
> - SETPROCTITLE_INIT MEMFD UFFD
> + SETPROCTITLE_INIT MEMFD
>
> # $1 - config name
> define gen-feature-test
> @@ -38,6 +38,10 @@ $(CONFIG_HEADER): include/config-base.h
> $(Q) @echo '#include "config-base.h"' >>
> $$@
> $(Q) @echo '' >>
> $$@
> $(call map,gen-feature-test,$(FEATURES_LIST))
> +ifeq ($$(UFFD),1)
> + $(Q) @echo '#define CONFIG_HAS_UFFD' >>
> $$@
> + $(Q) @echo '' >>
> $$@
> +endif
> ifeq ($$(VDSO),y)
> $(Q) @echo '#define CONFIG_VDSO' >>
> $$@
> $(Q) @echo '' >>
> $$@
>
> Through, slowdown will not be great (exec+cc a small program) - you
> may drop this and I'm fine.
> Maybe if we'll have more feature test that need Makefile define exports,
> we'll make some standard for makefile variables like $(UFFD) and
> clean this, but yet, I suggest adding this diff.
No problem, I will include this change in the next re-spin. Actually,
that was the implementation I had in the beginning until I found the
FEATURES_LIST functionality. Before re-sending the patches I am waiting
for further comments from Pavel.
Adrian
More information about the CRIU
mailing list