On 7/5/23 1:19 PM, Matthew Wilcox wrote:
On Wed, Jul 05, 2023 at 12:43:35PM -0700, Sidhartha Kumar wrote:
Saves one implicit call to compound_head()
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
@@ -4543,10 +4544,12 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf)
if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY)))
return ret;
+ folio = page_folio(vmf->page);
Why not move this down to after the call to finish_fault()? The
compiler should be able to do a better job with that; it may have to
spill it to the stack to preserve it over the function call.
I just noticed that the page inside the vmf was being used in
finish_fault() so it would stable enough to do the folio conversion
before. I can move it after for compiler reasons.
ret |= finish_fault(vmf);
- unlock_page(vmf->page);
+ folio_unlock(folio);
if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY)))
- put_page(vmf->page);
+ folio_put(folio);
return ret;