Skip to content

Commit

Permalink
mm: use a folio in fault_dirty_shared_page()
Browse files Browse the repository at this point in the history
We can replace four implicit calls to compound_head() with one by using
folio.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: ZhangPeng <[email protected]>
Reviewed-by: Sidhartha Kumar <[email protected]>
Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Nanyong Sun <[email protected]>
Cc: Sidhartha Kumar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
ZhangPeng authored and akpm00 committed Aug 18, 2023
1 parent c70699e commit 15b4919
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2965,20 +2965,20 @@ static vm_fault_t fault_dirty_shared_page(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct address_space *mapping;
struct page *page = vmf->page;
struct folio *folio = page_folio(vmf->page);
bool dirtied;
bool page_mkwrite = vma->vm_ops && vma->vm_ops->page_mkwrite;

dirtied = set_page_dirty(page);
VM_BUG_ON_PAGE(PageAnon(page), page);
dirtied = folio_mark_dirty(folio);
VM_BUG_ON_FOLIO(folio_test_anon(folio), folio);
/*
* Take a local copy of the address_space - page.mapping may be zeroed
* by truncate after unlock_page(). The address_space itself remains
* pinned by vma->vm_file's reference. We rely on unlock_page()'s
* Take a local copy of the address_space - folio.mapping may be zeroed
* by truncate after folio_unlock(). The address_space itself remains
* pinned by vma->vm_file's reference. We rely on folio_unlock()'s
* release semantics to prevent the compiler from undoing this copying.
*/
mapping = page_rmapping(page);
unlock_page(page);
mapping = folio_raw_mapping(folio);
folio_unlock(folio);

if (!page_mkwrite)
file_update_time(vma->vm_file);
Expand Down

0 comments on commit 15b4919

Please sign in to comment.