[CRIU] [RFC PATCH 12/12] lazy-pages: request userfaultfd events during API handshake

Mike Rapoport rppt at linux.vnet.ibm.com
Tue Jan 10 06:22:56 PST 2017


On Tue, Jan 10, 2017 at 05:07:45PM +0300, Pavel Emelyanov wrote:
> On 01/09/2017 11:23 AM, Mike Rapoport wrote:
> > Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
> > ---
> >  criu/uffd.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/criu/uffd.c b/criu/uffd.c
> > index 934c182..6e7179f 100644
> > --- a/criu/uffd.c
> > +++ b/criu/uffd.c
> > @@ -45,6 +45,10 @@
> >  
> >  #define LAZY_PAGES_SOCK_NAME	"lazy-pages.socket"
> >  
> > +#define NEED_UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK |	    \
> > +				UFFD_FEATURE_EVENT_REMAP |	    \
> > +				UFFD_FEATURE_EVENT_MADVDONTNEED)
> > +
> >  static mutex_t *lazy_sock_mutex;
> >  
> >  struct lazy_iovec {
> > @@ -222,7 +226,7 @@ int setup_uffd(int pid, struct task_restore_args *task_args)
> >  	 * Check if the UFFD_API is the one which is expected
> >  	 */
> >  	uffdio_api.api = UFFD_API;
> > -	uffdio_api.features = 0;
> > +	uffdio_api.features = kdat.uffd_features & NEED_UFFD_API_FEATURES;
> >  	if (ioctl(task_args->uffd, UFFDIO_API, &uffdio_api)) {
> 
> I don't remember exactly how this works ... shouldn't we read the supported
> features back and check for all of them being there?
> 

With the latest respin UFFDIO_API reports all the features kernel supports.
At init time we store those in kdat and here we just request the subset we
would like to use

> >  		pr_err("Checking for UFFDIO_API failed.\n");
> >  		goto err;
> > 
> 



More information about the CRIU mailing list