Skip to content

Commit 382360d

Browse files
Liu Shixinakpm00
authored andcommitted
mm/hugetlb: fix nid mismatch in alloc_surplus_hugetlb_folio()
It's wrong to use nid directly since the nid may be changed in allocation. Use folio_nid() to obtain the nid of folio instead. Fix: 2273dea ("mm/hugetlb: update nr_huge_pages and surplus_huge_pages together") Link: https://lkml.kernel.org/r/20250403064138.2867929-1-liushixin2@huawei.com Signed-off-by: Liu Shixin <liushixin2@huawei.com> Acked-by: Oscar Salvador <osalvador@suse.de> Cc: David Hildenbrand <david@redhat.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Muchun Song <muchun.song@linux.dev> Cc: Nanyong Sun <sunnanyong@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent c5bb27e commit 382360d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/hugetlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static struct folio *alloc_surplus_hugetlb_folio(struct hstate *h,
22712271
* as surplus_pages, otherwise it might confuse
22722272
* persistent_huge_pages() momentarily.
22732273
*/
2274-
__prep_account_new_huge_page(h, nid);
2274+
__prep_account_new_huge_page(h, folio_nid(folio));
22752275

22762276
/*
22772277
* We could have raced with the pool size change.

0 commit comments

Comments
 (0)