Re: [PATCH v2 3/4] mm/memory: convert do_shared_fault() to folios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 05, 2023 at 12:43:34PM -0700, Sidhartha Kumar wrote:
>  	/*
>  	 * Check if the backing address space wants to know that the page is
>  	 * about to become writable
>  	 */
>  	if (vma->vm_ops->page_mkwrite) {
> -		unlock_page(vmf->page);
> +		folio_unlock(folio);
>  		tmp = do_page_mkwrite(vmf);
>  		if (unlikely(!tmp ||
>  				(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) {
> -			put_page(vmf->page);
> +			folio_put(folio);

This is _probably_ OK.  However, do_page_mkwrite() calls
vm_ops->page_mkwrite(), and I think it's theoretically possible for the
driver to replace vmf->page with a different one.  The chance of them
actually doing that is pretty low (particularly if they return error or
nopage!), but I'm going to flag it just in case it comes up.

Also, should we pass a folio to do_page_mkwrite() instead of having it
extract the folio from vmf->page?

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux