Re: [v2 PATCH] mm: gup: do not call try_grab_folio() in slow path
From: Yang Shi
Date: Fri Jun 28 2024 - 14:27:39 EST
On Thu, Jun 27, 2024 at 11:35 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> > +int __must_check try_grab_folio(struct folio *folio, int refs, unsigned int flags)
>
> Overly long line (same for the external declaration)
>
> > + struct page *page = &folio->page;
>
> Page is only used for is_pci_p2pdma_page and is_zero_page, and for
> the latter a is_zero_folio already exist. Maybe remove the local
> variable, use is_zero_folio and just open code the dereference in the
> is_pci_p2pdma_page call?
Thanks, Christoph. Good point, I think we can use is_zero_folio and
open coeded it in is_pci_p2pdma_page.
And all the format problems will be solved in v3.
>
> > + ret = gup_hugepte(vma, ptep, sz, addr, end, flags, pages, nr, fast);
>
> Overly lone line.
>
> > + folio_ref_add(folio,
> > + refs * (GUP_PIN_COUNTING_BIAS - 1));
>
> Nit: this easily fits onto a single line.
>
> > if (gup_hugepd(NULL, __hugepd(pmd_val(pmd)), addr,
> > - PMD_SHIFT, next, flags, pages, nr) != 1)
> > + PMD_SHIFT, next, flags, pages, nr, true) != 1)
>
> Overly long lin (same in the similar calls below)
>
>