summaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorSidhartha Kumar <sidhartha.kumar@oracle.com>2023-07-10 22:35:44 -0700
committerAndrew Morton <akpm@linux-foundation.org>2023-08-18 10:12:21 -0700
commit86aa6998ad00af823de81d12d41d7063c14298a0 (patch)
tree9ee5c67a22ce2c359e2fcd51a37e5122bcffe80c /mm/memory.c
parentd31155b8f29ce380f7816e54dee161db6d752909 (diff)
mm/memory: pass folio into do_page_mkwrite()
Saves one implicit call to compound_head(). I'm not sure if I should change the name of the function to do_folio_mkwrite() and update the description comment to reference a folio as the vm_op is still called page_mkwrite. Link: https://lkml.kernel.org/r/20230711053544.156617-1-sidhartha.kumar@oracle.com Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com> Suggested-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 36b164ee9ffb..44d11812a88f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2933,10 +2933,9 @@ static gfp_t __get_fault_gfp_mask(struct vm_area_struct *vma)
*
* We do this without the lock held, so that it can sleep if it needs to.
*/
-static vm_fault_t do_page_mkwrite(struct vm_fault *vmf)
+static vm_fault_t do_page_mkwrite(struct vm_fault *vmf, struct folio *folio)
{
vm_fault_t ret;
- struct folio *folio = page_folio(vmf->page);
unsigned int old_flags = vmf->flags;
vmf->flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE;
@@ -3298,7 +3297,7 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf, struct folio *folio)
vm_fault_t tmp;
pte_unmap_unlock(vmf->pte, vmf->ptl);
- tmp = do_page_mkwrite(vmf);
+ tmp = do_page_mkwrite(vmf, folio);
if (unlikely(!tmp || (tmp &
(VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) {
folio_put(folio);
@@ -4621,7 +4620,7 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf)
*/
if (vma->vm_ops->page_mkwrite) {
folio_unlock(folio);
- tmp = do_page_mkwrite(vmf);
+ tmp = do_page_mkwrite(vmf, folio);
if (unlikely(!tmp ||
(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) {
folio_put(folio);