Skip to content

Commit 62d549e

Browse files
David Hildenbrandopsiff
authored andcommitted
mm/rmap: pass folio to hugepage_add_anon_rmap()
mainline inclusion from mainline-v6.7-rc1 category: performance Let's pass a folio; we are always mapping the entire thing. Link: https://lkml.kernel.org/r/20230913125113.313322-7-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Muchun Song <muchun.song@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commit 09c5505) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 3af4006 commit 62d549e

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

include/linux/rmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void folio_add_file_rmap_range(struct folio *, struct page *, unsigned int nr,
203203
void page_remove_rmap(struct page *, struct vm_area_struct *,
204204
bool compound);
205205

206-
void hugepage_add_anon_rmap(struct page *, struct vm_area_struct *,
206+
void hugepage_add_anon_rmap(struct folio *, struct vm_area_struct *,
207207
unsigned long address, rmap_t flags);
208208
void hugepage_add_new_anon_rmap(struct folio *, struct vm_area_struct *,
209209
unsigned long address);

mm/migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static bool remove_migration_pte(struct folio *folio,
249249

250250
pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
251251
if (folio_test_anon(folio))
252-
hugepage_add_anon_rmap(new, vma, pvmw.address,
252+
hugepage_add_anon_rmap(folio, vma, pvmw.address,
253253
rmap_flags);
254254
else
255255
page_dup_file_rmap(new, true);

mm/rmap.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,18 +2583,16 @@ void rmap_walk_locked(struct folio *folio, struct rmap_walk_control *rwc)
25832583
*
25842584
* RMAP_COMPOUND is ignored.
25852585
*/
2586-
void hugepage_add_anon_rmap(struct page *page, struct vm_area_struct *vma,
2586+
void hugepage_add_anon_rmap(struct folio *folio, struct vm_area_struct *vma,
25872587
unsigned long address, rmap_t flags)
25882588
{
2589-
struct folio *folio = page_folio(page);
2590-
25912589
VM_WARN_ON_FOLIO(!folio_test_anon(folio), folio);
25922590

25932591
atomic_inc(&folio->_entire_mapcount);
25942592
if (flags & RMAP_EXCLUSIVE)
2595-
SetPageAnonExclusive(page);
2593+
SetPageAnonExclusive(&folio->page);
25962594
VM_WARN_ON_FOLIO(folio_entire_mapcount(folio) > 1 &&
2597-
PageAnonExclusive(page), folio);
2595+
PageAnonExclusive(&folio->page), folio);
25982596
}
25992597

26002598
void hugepage_add_new_anon_rmap(struct folio *folio,

0 commit comments

Comments
 (0)