Re: [PATCH 1/4] mm/gup: add compound page list iterator

2021-02-04 Thread John Hubbard
On 2/4/21 11:53 AM, Jason Gunthorpe wrote: On Wed, Feb 03, 2021 at 03:00:01PM -0800, John Hubbard wrote: +static inline void compound_next(unsigned long i, unsigned long npages, +struct page **list, struct page **head, +unsigned

Re: [PATCH 1/4] mm/gup: add compound page list iterator

2021-02-04 Thread Jason Gunthorpe
On Wed, Feb 03, 2021 at 03:00:01PM -0800, John Hubbard wrote: > > +static inline void compound_next(unsigned long i, unsigned long npages, > > +struct page **list, struct page **head, > > +unsigned int *ntails) > > +{ > > + if (i >= npages)

Re: [PATCH 1/4] mm/gup: add compound page list iterator

2021-02-04 Thread Joao Martins
On 2/4/21 11:27 AM, Joao Martins wrote: > On 2/3/21 11:00 PM, John Hubbard wrote: >> On 2/3/21 2:00 PM, Joao Martins wrote: >>> Add an helper that iterates over head pages in a list of pages. It >>> essentially counts the tails until the next page to process has a >>> different head that the

Re: [PATCH 1/4] mm/gup: add compound page list iterator

2021-02-04 Thread Joao Martins
On 2/3/21 11:00 PM, John Hubbard wrote: > On 2/3/21 2:00 PM, Joao Martins wrote: >> Add an helper that iterates over head pages in a list of pages. It >> essentially counts the tails until the next page to process has a >> different head that the current. This is going to be used by >>

Re: [PATCH 1/4] mm/gup: add compound page list iterator

2021-02-03 Thread John Hubbard
On 2/3/21 2:00 PM, Joao Martins wrote: Add an helper that iterates over head pages in a list of pages. It essentially counts the tails until the next page to process has a different head that the current. This is going to be used by unpin_user_pages() family of functions, to batch the head page

[PATCH 1/4] mm/gup: add compound page list iterator

2021-02-03 Thread Joao Martins
Add an helper that iterates over head pages in a list of pages. It essentially counts the tails until the next page to process has a different head that the current. This is going to be used by unpin_user_pages() family of functions, to batch the head page refcount updates once for all passed