@@ -1956,10 +1956,10 @@ void free_huge_page(struct page *page)
19561956
19571957 spin_lock_irqsave (& hugetlb_lock , flags );
19581958 folio_clear_hugetlb_migratable (folio );
1959- hugetlb_cgroup_uncharge_page (hstate_index (h ),
1960- pages_per_huge_page (h ), page );
1961- hugetlb_cgroup_uncharge_page_rsvd (hstate_index (h ),
1962- pages_per_huge_page (h ), page );
1959+ hugetlb_cgroup_uncharge_folio (hstate_index (h ),
1960+ pages_per_huge_page (h ), folio );
1961+ hugetlb_cgroup_uncharge_folio_rsvd (hstate_index (h ),
1962+ pages_per_huge_page (h ), folio );
19631963 if (restore_reserve )
19641964 h -> resv_huge_pages ++ ;
19651965
@@ -3082,6 +3082,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
30823082 struct hugepage_subpool * spool = subpool_vma (vma );
30833083 struct hstate * h = hstate_vma (vma );
30843084 struct page * page ;
3085+ struct folio * folio ;
30853086 long map_chg , map_commit ;
30863087 long gbl_chg ;
30873088 int ret , idx ;
@@ -3145,6 +3146,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
31453146 * a reservation exists for the allocation.
31463147 */
31473148 page = dequeue_huge_page_vma (h , vma , addr , avoid_reserve , gbl_chg );
3149+
31483150 if (!page ) {
31493151 spin_unlock_irq (& hugetlb_lock );
31503152 page = alloc_buddy_huge_page_with_mpol (h , vma , addr );
@@ -3159,6 +3161,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
31593161 set_page_refcounted (page );
31603162 /* Fall through */
31613163 }
3164+ folio = page_folio (page );
31623165 hugetlb_cgroup_commit_charge (idx , pages_per_huge_page (h ), h_cg , page );
31633166 /* If allocation is not consuming a reservation, also store the
31643167 * hugetlb_cgroup pointer on the page.
@@ -3188,8 +3191,8 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
31883191 rsv_adjust = hugepage_subpool_put_pages (spool , 1 );
31893192 hugetlb_acct_memory (h , - rsv_adjust );
31903193 if (deferred_reserve )
3191- hugetlb_cgroup_uncharge_page_rsvd (hstate_index (h ),
3192- pages_per_huge_page (h ), page );
3194+ hugetlb_cgroup_uncharge_folio_rsvd (hstate_index (h ),
3195+ pages_per_huge_page (h ), folio );
31933196 }
31943197 return page ;
31953198
0 commit comments