Re: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-08 Thread David Hildenbrand
On 08.12.23 08:57, Kasireddy, Vivek wrote: Hi David, On 05.12.23 06:35, Vivek Kasireddy wrote: For drivers that would like to longterm-pin the pages associated with a memfd, the pin_user_pages_fd() API provides an option to not only pin the pages via FOLL_PIN but also to check and migrate

RE: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-07 Thread Kasireddy, Vivek
Hi David, > > > >> On 05.12.23 06:35, Vivek Kasireddy wrote: > >>> For drivers that would like to longterm-pin the pages associated > >>> with a memfd, the pin_user_pages_fd() API provides an option to > >>> not only pin the pages via FOLL_PIN but also to check and migrate > >>> them if they

Re: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-07 Thread David Hildenbrand
On 07.12.23 14:05, Jason Gunthorpe wrote: On Thu, Dec 07, 2023 at 10:44:14AM +0100, David Hildenbrand wrote: If you always want to return folios, then better name it "memfd_pin_user_folios" (or just "memfd_pin_folios") and pass in a range (instead of a nr_pages parameter), and somehow indicate

Re: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-07 Thread Jason Gunthorpe
On Thu, Dec 07, 2023 at 10:44:14AM +0100, David Hildenbrand wrote: > > > If you always want to return folios, then better name it > > > "memfd_pin_user_folios" (or just "memfd_pin_folios") and pass in a range > > > (instead of a nr_pages parameter), and somehow indicate to the caller > > > how

Re: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-07 Thread David Hildenbrand
On 07.12.23 06:09, Kasireddy, Vivek wrote: Hi David, On 05.12.23 06:35, Vivek Kasireddy wrote: For drivers that would like to longterm-pin the pages associated with a memfd, the pin_user_pages_fd() API provides an option to not only pin the pages via FOLL_PIN but also to check and migrate

RE: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-06 Thread Kasireddy, Vivek
Hi David, > On 05.12.23 06:35, Vivek Kasireddy wrote: > > For drivers that would like to longterm-pin the pages associated > > with a memfd, the pin_user_pages_fd() API provides an option to > > not only pin the pages via FOLL_PIN but also to check and migrate > > them if they reside in movable

RE: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-06 Thread Kasireddy, Vivek
Hi, > > +struct page *memfd_alloc_page(struct file *memfd, pgoff_t idx) > > +{ > > +#ifdef CONFIG_HUGETLB_PAGE > > + struct folio *folio; > > + int err; > > + > > + if (is_file_hugepages(memfd)) { > > + folio = alloc_hugetlb_folio_nodemask(hstate_file(memfd), > > +

Re: [PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-06 Thread David Hildenbrand
On 05.12.23 06:35, Vivek Kasireddy wrote: For drivers that would like to longterm-pin the pages associated with a memfd, the pin_user_pages_fd() API provides an option to not only pin the pages via FOLL_PIN but also to check and migrate them if they reside in movable zone or CMA block. This API

[PATCH v6 3/5] mm/gup: Introduce memfd_pin_user_pages() for pinning memfd pages (v6)

2023-12-04 Thread Vivek Kasireddy
For drivers that would like to longterm-pin the pages associated with a memfd, the pin_user_pages_fd() API provides an option to not only pin the pages via FOLL_PIN but also to check and migrate them if they reside in movable zone or CMA block. This API currently works with memfds but it should