mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
BACKPORT: mm/rmap: move SetPageAnonExclusive() out of page_move_anon_rmap()
Patch series "mm/rmap: convert page_move_anon_rmap() to folio_move_anon_rmap()". Convert page_move_anon_rmap() to folio_move_anon_rmap(), letting the callers handle PageAnonExclusive. I'm including cleanup patch #3 because it fits into the picture and can be done cleaner by the conversion. This patch (of 3): Let's move it into the caller: there is a difference between whether an anon folio can only be mapped by one process (e.g., into one VMA), and whether it is truly exclusive (e.g., no references -- including GUP -- from other processes). Further, for large folios the page might not actually be pointing at the head page of the folio, so it better be handled in the caller. This is a preparation for converting page_move_anon_rmap() to consume a folio. Link: https://lkml.kernel.org/r/20231002142949.235104-1-david@redhat.com Link: https://lkml.kernel.org/r/20231002142949.235104-2-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Muchun Song <muchun.song@linux.dev> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Conflicts: 1. mm/hugetlb.c [Due to page_mapcount() instead of folio_mapcount() and folio_test_anon() instead of PageAnon()] (cherry picked from commit 5ca432896a4ce6d69fffc3298b24c0dd9bdb871f) Bug: 413428616 Bug: 313807618 Change-Id: Ibd29fec4d2a521d5ffc0782effd855cde9687a78 Signed-off-by: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
This commit is contained in:
committed by
Lokesh Gidra
parent
6a8cf1324d
commit
d8a28dde36
@@ -1372,6 +1372,7 @@ vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf)
|
||||
pmd_t entry;
|
||||
|
||||
page_move_anon_rmap(page, vma);
|
||||
SetPageAnonExclusive(page);
|
||||
folio_unlock(folio);
|
||||
reuse:
|
||||
if (unlikely(unshare)) {
|
||||
|
||||
@@ -5581,8 +5581,10 @@ retry_avoidcopy:
|
||||
* owner and can reuse this page.
|
||||
*/
|
||||
if (page_mapcount(old_page) == 1 && PageAnon(old_page)) {
|
||||
if (!PageAnonExclusive(old_page))
|
||||
if (!PageAnonExclusive(old_page)) {
|
||||
page_move_anon_rmap(old_page, vma);
|
||||
SetPageAnonExclusive(old_page);
|
||||
}
|
||||
if (likely(!unshare))
|
||||
set_huge_ptep_writable(vma, haddr, ptep);
|
||||
|
||||
|
||||
@@ -3561,6 +3561,7 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
|
||||
* sunglasses. Hit it.
|
||||
*/
|
||||
page_move_anon_rmap(vmf->page, vma);
|
||||
SetPageAnonExclusive(vmf->page);
|
||||
folio_unlock(folio);
|
||||
reuse:
|
||||
if (unlikely(unshare)) {
|
||||
|
||||
Reference in New Issue
Block a user