summaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2023-10-02 16:29:47 +0200
committerAndrew Morton <akpm@linux-foundation.org>2023-10-18 14:34:14 -0700
commit5ca432896a4ce6d69fffc3298b24c0dd9bdb871f (patch)
treecedc3460b731649628ab1dfdbdd738b0bc24b1ff /mm/hugetlb.c
parent4a68fef16df9d88d528094116f8bbd2dbfa62089 (diff)
downloadlinux-5ca432896a4ce6d69fffc3298b24c0dd9bdb871f.tar.gz
linux-5ca432896a4ce6d69fffc3298b24c0dd9bdb871f.tar.bz2
linux-5ca432896a4ce6d69fffc3298b24c0dd9bdb871f.zip
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>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2878e0e6bac5..35d924f74972 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5652,8 +5652,10 @@ retry_avoidcopy:
* owner and can reuse this page.
*/
if (folio_mapcount(old_folio) == 1 && folio_test_anon(old_folio)) {
- if (!PageAnonExclusive(&old_folio->page))
+ if (!PageAnonExclusive(&old_folio->page)) {
page_move_anon_rmap(&old_folio->page, vma);
+ SetPageAnonExclusive(&old_folio->page);
+ }
if (likely(!unshare))
set_huge_ptep_writable(vma, haddr, ptep);