lkml.org 
[lkml]   [2021]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mm: khugepaged: skip huge page collapse for special files
On Wed, Oct 27, 2021 at 1:53 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 27 Oct 2021 13:44:37 -0700 Yang Shi <shy828301@gmail.com> wrote:
>
> > > > --- a/mm/khugepaged.c
> > > > +++ b/mm/khugepaged.c
> > > > @@ -445,22 +445,25 @@ static bool hugepage_vma_check(struct vm_area_struct *vma,
> > > > if (!transhuge_vma_enabled(vma, vm_flags))
> > > > return false;
> > > >
> > > > - /* Enabled via shmem mount options or sysfs settings. */
> > > > - if (shmem_file(vma->vm_file) && shmem_huge_enabled(vma)) {
> > > > + if (vma->vm_file)
> > > > return IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
> > > > HPAGE_PMD_NR);
> > >
> > > Am I misreading this? If we return here for vma->vm_file, the following
> > > logic (shmem_file(), etc.) would be skipped, no?
> >
> > Oh, yes, you are right. My mistake.
> >
> > Andrew,
> >
> > Could you please apply the below fix?
>
> um, how well tested are these changes?

I has this fix on my test machine, but somehow forgot to fold it into
the original patch. The whole fix was tested by opening /dev/nullb0
readonly and mapping with PROT_EXEC, the THP was not collapsed
anymore.

\
 
 \ /
  Last update: 2021-10-27 23:58    [W:0.034 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site