[CRIU] [PATCH v4 4/6] mem: add dump state of THP_DISABLED prctl

Mike Rapoport rppt at linux.vnet.ibm.com
Wed Jun 28 15:05:41 MSK 2017


On Wed, Jun 28, 2017 at 01:56:46PM +0300, Pavel Emelyanov wrote:
> On 06/28/2017 09:43 AM, Mike Rapoport wrote:
> > Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
> > ---
> >  criu/cr-dump.c          | 3 +++
> >  criu/include/parasite.h | 1 +
> >  criu/pie/parasite.c     | 1 +
> >  images/mm.proto         | 1 +
> >  4 files changed, 6 insertions(+)
> > 
> > diff --git a/criu/cr-dump.c b/criu/cr-dump.c
> > index 3f9f8d0..308cc4e 100644
> > --- a/criu/cr-dump.c
> > +++ b/criu/cr-dump.c
> > @@ -507,6 +507,9 @@ static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
> >  	mme.dumpable = misc->dumpable;
> >  	mme.has_dumpable = true;
> >  
> > +	mme.thp_disabled = misc->thp_disabled;
> > +	mme.has_thp_disabled = true;
> > +
> >  	mme.n_mm_saved_auxv = AT_VECTOR_SIZE;
> >  	mme.mm_saved_auxv = xmalloc(pb_repeated_size(&mme, mm_saved_auxv));
> >  	if (!mme.mm_saved_auxv)
> > diff --git a/criu/include/parasite.h b/criu/include/parasite.h
> > index cd6d793..115891f 100644
> > --- a/criu/include/parasite.h
> > +++ b/criu/include/parasite.h
> > @@ -124,6 +124,7 @@ struct parasite_dump_misc {
> >  	u32 umask;
> >  
> >  	int dumpable;
> > +	int thp_disabled;
> >  };
> >  
> >  /*
> > diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
> > index fe08e72..78bbe9e 100644
> > --- a/criu/pie/parasite.c
> > +++ b/criu/pie/parasite.c
> > @@ -177,6 +177,7 @@ static int dump_misc(struct parasite_dump_misc *args)
> >  	args->umask = sys_umask(0);
> >  	sys_umask(args->umask); /* never fails */
> >  	args->dumpable = sys_prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
> > +	args->thp_disabled = sys_prctl(PR_GET_THP_DISABLE, 0, 0, 0, 0);
> 
> How will this work OK on kernels without this prctl fixed?

The same way as after the fix :)
The prctl(PR_SET_THP_DISABLE) in any case sets a flag in 'struct
mm_struct' and the prctl(PR_GET_THP_DISABLE) returns 1 if such flag is set.
The change in the SET behaviour that was introduced recently is completely
internal to mm and it only changes the way the flag in 'struct mm_struct'
is treated by khugepaged and page allocation path.
 
> >  	return 0;
> >  }
> > diff --git a/images/mm.proto b/images/mm.proto
> > index b372f45..e0f14c6 100644
> > --- a/images/mm.proto
> > +++ b/images/mm.proto
> > @@ -29,4 +29,5 @@ message mm_entry {
> >  
> >  	optional int32	dumpable	= 15;
> >  	repeated aio_ring_entry	aios	= 16;
> > +	optional bool thp_disabled	= 17;
> >  }
> > 
> 



More information about the CRIU mailing list