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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 17 Apr 2024 12:35:33 +0800
From: Lance Yang <ioworker0@...il.com>
To: David Hildenbrand <david@...hat.com>
Cc: Ryan Roberts <ryan.roberts@....com>, akpm@...ux-foundation.org, 21cnbao@...il.com, 
	mhocko@...e.com, fengwei.yin@...el.com, zokeefe@...gle.com, 
	shy828301@...il.com, xiehuan09@...il.com, wangkefeng.wang@...wei.com, 
	songmuchun@...edance.com, peterx@...hat.com, minchan@...nel.org, 
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 3/3] mm/madvise: optimize lazyfreeing with mTHP in madvise_free

Hey Ryan, David,

Thanks for taking time to review!

On Wed, Apr 17, 2024 at 12:52 AM David Hildenbrand <david@...hat.com> wrote:
>
> >> +                    nr = madvise_folio_pte_batch(addr, end, folio, pte,
> >> +                                                 ptent, &any_young, &any_dirty);
> >> +
> >> +                    if (nr < folio_nr_pages(folio)) {
> >> +                            if (folio_likely_mapped_shared(folio))
> >> +                                    continue;
> >> +
> >> +                            arch_leave_lazy_mmu_mode();
> >> +                            if (madvise_pte_split_folio(mm, pmd, addr,
> >> +                                                        folio, &start_pte, &ptl))
> >> +                                    nr = 0;
> >> +                            if (!start_pte)
> >> +                                    break;
> >> +                            pte = start_pte;
> >> +                            arch_enter_lazy_mmu_mode();
> >> +                            continue;
> >> +                    }
> >> +
> >> +                    if (any_young)
> >> +                            ptent = pte_mkyoung(ptent);
> >> +                    if (any_dirty)
> >> +                            ptent = pte_mkdirty(ptent);
> >>              }
> >>
> >> +            if (folio_mapcount(folio) != folio_nr_pages(folio))
> >> +                    continue;
> >
> > Why is this here? I thought we had previously concluded to only do this test
> > inside the below if statement (where you have it duplicated).

My bad for this mistake - sorry!

>
> I stumbled over these same while reviewing. It's not exactly duplicate,
> because it's unreliable without the folio lock. It looks more like an
> best-effort early check.
>
> But then, we also add it to cases where we previously wouldn't check the
> mapcount at all: when the folio was added to the swapcache or is already
> dirty.
>
> In that case, we would even see a change for order-0 folios with that
> new check.

Thanks for pointing that out! I'll remove this check here in the next version.

I overlooked that this is a new check for order-0 folios :(

Thanks,
Lance

>
> --
> Cheers,
>
> David / dhildenb
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ