@@ -1956,10 +1956,10 @@ void free_huge_page(struct page *page)
1956
1956
1957
1957
spin_lock_irqsave (& hugetlb_lock , flags );
1958
1958
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 );
1963
1963
if (restore_reserve )
1964
1964
h -> resv_huge_pages ++ ;
1965
1965
@@ -3082,6 +3082,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
3082
3082
struct hugepage_subpool * spool = subpool_vma (vma );
3083
3083
struct hstate * h = hstate_vma (vma );
3084
3084
struct page * page ;
3085
+ struct folio * folio ;
3085
3086
long map_chg , map_commit ;
3086
3087
long gbl_chg ;
3087
3088
int ret , idx ;
@@ -3145,6 +3146,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
3145
3146
* a reservation exists for the allocation.
3146
3147
*/
3147
3148
page = dequeue_huge_page_vma (h , vma , addr , avoid_reserve , gbl_chg );
3149
+
3148
3150
if (!page ) {
3149
3151
spin_unlock_irq (& hugetlb_lock );
3150
3152
page = alloc_buddy_huge_page_with_mpol (h , vma , addr );
@@ -3159,6 +3161,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
3159
3161
set_page_refcounted (page );
3160
3162
/* Fall through */
3161
3163
}
3164
+ folio = page_folio (page );
3162
3165
hugetlb_cgroup_commit_charge (idx , pages_per_huge_page (h ), h_cg , page );
3163
3166
/* If allocation is not consuming a reservation, also store the
3164
3167
* hugetlb_cgroup pointer on the page.
@@ -3188,8 +3191,8 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
3188
3191
rsv_adjust = hugepage_subpool_put_pages (spool , 1 );
3189
3192
hugetlb_acct_memory (h , - rsv_adjust );
3190
3193
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 );
3193
3196
}
3194
3197
return page ;
3195
3198
0 commit comments