[PATCH v7 5/6] udmabuf: Pin the pages using memfd_pin_folios() API (v5)

Matthew Wilcox willy at infradead.org
Wed Dec 13 18:03:59 UTC 2023


On Mon, Dec 11, 2023 at 11:38:02PM -0800, Vivek Kasireddy wrote:
> +++ b/drivers/dma-buf/udmabuf.c
> @@ -42,7 +42,7 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
>  	if (pgoff >= ubuf->pagecount)
>  		return VM_FAULT_SIGBUS;
>  
> -	pfn = page_to_pfn(&ubuf->folios[pgoff]->page);
> +	pfn = page_to_pfn(folio_page(ubuf->folios[pgoff], 0));

Why are you changing from &folio->page to folio_page(folio, 0) in
this patch?  Either that should have been done the other way in the
earlier patch, or it shouldn't be done at all.

My vote is that it shuoldn't be done at all.  These all seem like "I
have to convert back from folio to page because the APIs I want aren't
available", not "I want the first page from this folio".



More information about the dri-devel mailing list