Re: [patch 3/3] [PATCH] prctl: Add PR_SET_MM codes to set up mm_struct entires v3

Cyrill Gorcunov
2011-12-12T22:01:38Z

On Mon, Dec 12, 2011 at 01:53:23PM -0800, Andrew Morton wrote:
...
> >
> > +#ifdef CONFIG_CHECKPOINT_RESTORE
> > +static int prctl_set_mm(int opt, unsigned long addr,
> > + unsigned long arg4, unsigned long arg5)
> > +{
> > + unsigned long rlim = rlimit(RLIMIT_DATA);
> > + unsigned long vm_req_flags;
> > + unsigned long vm_bad_flags;
> > + struct vm_area_struct *vma;
> > + int error = 0;
> > +
> > + if (arg4 | arg5)
> > + return -EINVAL;
> > +
> > + if (!capable(CAP_SYS_ADMIN))
> > + return -EPERM;
> > +
> > + if (addr >= TASK_SIZE)
> > + return -EINVAL;
> > +
> > + down_read(&current->mm->mmap_sem);
>
> This may not be true of all compiler versions, but when I cache
> current->mm in a local, the code size is reduced rather a lot:
>
> akpm:/usr/src/25> size kernel/sys.o
> text data bss dec hex filename
> 22685 14376 7616 44677 ae85 kernel/sys.o
> 22489 14376 7616 44481 adc1 kernel/sys.o
>

Hmm, this is great and weird. Letme try...

Cyrill