Re: [PATCH 2/4] mm/memory: convert wp_page_shared() to use folios

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

 



On 2023/7/3 13:58, Sidhartha Kumar wrote:

Saves five implicit calls to compound_head().

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>

Reviewed-by: ZhangPeng <zhangpeng362@xxxxxxxxxx>

---
  mm/memory.c | 13 +++++++------
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 098fac2f5efc0..93480e846ace6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3286,8 +3286,9 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf)
  {
  	struct vm_area_struct *vma = vmf->vma;
  	vm_fault_t ret = 0;
+	struct folio *folio = page_folio(vmf->page);
- get_page(vmf->page);
+	folio_get(folio);
if (vma->vm_ops && vma->vm_ops->page_mkwrite) {
  		vm_fault_t tmp;
@@ -3296,21 +3297,21 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf)
  		tmp = do_page_mkwrite(vmf);
  		if (unlikely(!tmp || (tmp &
  				      (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) {
-			put_page(vmf->page);
+			folio_put(folio);
  			return tmp;
  		}
  		tmp = finish_mkwrite_fault(vmf);
  		if (unlikely(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) {
-			unlock_page(vmf->page);
-			put_page(vmf->page);
+			folio_unlock(folio);
+			folio_put(folio);
  			return tmp;
  		}
  	} else {
  		wp_page_reuse(vmf);
-		lock_page(vmf->page);
+		folio_lock(folio);
  	}
  	ret |= fault_dirty_shared_page(vmf);
-	put_page(vmf->page);
+	folio_put(folio);
return ret;
  }




[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