lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK1f24nr4khVun9eSanywYhA3-0LGn-ZDV2kLVkToRTekVfG2g@mail.gmail.com>
Date: Thu, 13 Jun 2024 16:56:34 +0800
From: Lance Yang <ioworker0@...il.com>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: akpm@...ux-foundation.org, 21cnbao@...il.com, david@...hat.com, 
	fengwei.yin@...el.com, libang.li@...group.com, linux-kernel@...r.kernel.org, 
	linux-mm@...ck.org, maskray@...gle.com, mhocko@...e.com, minchan@...nel.org, 
	peterx@...hat.com, ryan.roberts@....com, shy828301@...il.com, sj@...nel.org, 
	songmuchun@...edance.com, wangkefeng.wang@...wei.com, willy@...radead.org, 
	xiehuan09@...il.com, ziy@...dia.com, zokeefe@...gle.com
Subject: Re: [PATCH v7 4/4] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()

On Thu, Jun 13, 2024 at 4:20 PM Baolin Wang
<baolin.wang@...ux.alibaba.com> 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@gmail.com/
> >
> > 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ