Re: [PATCH 1/1] mm/mlock: implement folio_mlock_step() using folio_pte_batch()
From: Lance Yang
Date: Mon Jun 03 2024 - 00:13:48 EST
Hi Matthew,
Thanks for taking time to review!
On Mon, Jun 3, 2024 at 11:36 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Mon, Jun 03, 2024 at 11:31:17AM +0800, Lance Yang wrote:
> > {
> > - unsigned int count, i, nr = folio_nr_pages(folio);
> > - unsigned long pfn = folio_pfn(folio);
> > - pte_t ptent = ptep_get(pte);
>
> Please don't move type declarations later in the function. Just because
> you can doesn't mean you should.
Thanks for pointing this out, I'll adjust as you suggested.
>
> > - if (!folio_test_large(folio))
> > + if (likely(!folio_test_large(folio)))
> > return 1;
>
> How likely is this now? How likely will it be in two years time?
> Does this actually make any difference in either code generation or
> performance?
IMO, this hint could impact code generation and performance :)
But it seems that 'likely' is not necessary here. I'll remove it.
Thanks again for your time!
Lance
>