Skip to content

Commit 15b4919

Browse files
ZhangPengakpm00
authored andcommitted
mm: use a folio in fault_dirty_shared_page()
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]>
1 parent c70699e commit 15b4919

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mm/memory.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,20 +2965,20 @@ static vm_fault_t fault_dirty_shared_page(struct vm_fault *vmf)
29652965
{
29662966
struct vm_area_struct *vma = vmf->vma;
29672967
struct address_space *mapping;
2968-
struct page *page = vmf->page;
2968+
struct folio *folio = page_folio(vmf->page);
29692969
bool dirtied;
29702970
bool page_mkwrite = vma->vm_ops && vma->vm_ops->page_mkwrite;
29712971

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

29832983
if (!page_mkwrite)
29842984
file_update_time(vma->vm_file);

0 commit comments

Comments
 (0)