Re: [PATCH mm-unstable v4 03/10] mm/madvise: add file and shmem support to MADV_COLLAPSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +/* hpage must be locked, and mmap_lock must be held in write */
> > +static int set_huge_pmd(struct vm_area_struct *vma, unsigned long addr,
> > +                       pmd_t *pmdp, struct page *hpage)
> > +{
> > +       struct vm_fault vmf = {
> > +               .vma = vma,
> > +               .address = addr,
> > +               .flags = 0,
>
> It means you are going to install a readonly PMD. It is fine for
> readonly fs, but it may be not performant for shmem since the
> following write will trigger wp fault then the PMD will be split. So
> it should be ok to install writable PMD for shmem.
>
> But anyway this is not a fatal problem, the patch looks good to me.
> Reviewed-by: Yang Shi <shy828301@xxxxxxxxx>
>

Thanks, Yang!

I haven't worked out the details for writable shmem, but I'm hoping
FAULT_FLAG_WRITE is enough here.

I'm also now wondering if FAULT_FLAG_REMOTE is needed here for
process_madvise(MADV_COLLAPSE) when called on behalf of another
process; though that would also mean it's needed in
__collapse_huge_page_swapin() as well (even when running as
khugepaged). I can't say I fully understand 1b2ee1266ea6 ("mm/core: Do
not enforce PKEY permissions on remote mm access"), but if the comment
in include/linux/mm_types.h is to be trusted, then this would be the
case.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux