Re: [PATCH v7 4/4] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()

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

 



On Thu, Jun 13, 2024 at 4:20 PM Baolin Wang
<baolin.wang@xxxxxxxxxxxxxxxxx> wrote:
>
>
>
> On 2024/6/13 15:28, Lance Yang wrote:
> > Hi Andrew,
> >
> > I'd like to fix the bug[1] I mentioned previously. Could you please fold the
> > following changes into this patch?
> >
> > [1] https://lore.kernel.org/linux-mm/20240613065521.15960-1-ioworker0@xxxxxxxxx/
> >
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index f409ea9fcc18..425374ae06ed 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -2707,10 +2707,8 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
> >       if (unlikely(page_folio(page) != folio))
> >               return false;
> >
> > -     if (folio_test_dirty(folio) || pmd_dirty(orig_pmd)) {
> > -             folio_set_swapbacked(folio);
> > +     if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> >               return false;
> > -     }
> >
> >       orig_pmd = pmdp_huge_clear_flush(vma, addr, pmdp);
> >
> > @@ -2737,10 +2735,8 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
> >        *
> >        * The only folio refs must be one from isolation plus the rmap(s).
> >        */
> > -     if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> > -             folio_set_swapbacked(folio);
> > -
> > -     if (folio_test_swapbacked(folio) || ref_count != map_count + 1) {
> > +     if (folio_test_dirty(folio) || pmd_dirty(orig_pmd) ||
> > +         ref_count != map_count + 1) {
> >               set_pmd_at(mm, addr, pmdp, orig_pmd);
> >               return false;
> >       }
> > diff --git a/mm/rmap.c b/mm/rmap.c
> > index b9e5943c8349..393e2c11c44c 100644
> > --- a/mm/rmap.c
> > +++ b/mm/rmap.c
> > @@ -1824,12 +1824,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
> >                        */
> >                       if (unlikely(folio_test_swapbacked(folio) !=
> >                                       folio_test_swapcache(folio))) {
> > -                             /*
> > -                              * unmap_huge_pmd_locked() will unmark a
> > -                              * PMD-mapped folio as lazyfree if the folio or
> > -                              * its PMD was redirtied.
> > -                              */
> > -                             WARN_ON_ONCE(!pmd_mapped);
> > +                             WARN_ON_ONCE(1);
> >                               goto walk_done_err;
> >                       }
> >
>
> You can also drop the unused 'pmd_mapped' variable now.

Good catch!

Will drop it in the next version.

Thanks,
Lance





[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