Message ID | 20250403064138.2867929-1-liushixin2@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm/hugetlb: fix nid mismatch in alloc_surplus_hugetlb_folio() | expand |
On Thu, Apr 03, 2025 at 02:41:38PM +0800, Liu Shixin wrote: > 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: 2273dea6b1e1 ("mm/hugetlb: update nr_huge_pages and surplus_huge_pages together") > Signed-off-by: Liu Shixin <liushixin2@huawei.com> Acked-by: Oscar Salvador <osalvador@suse.de>
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6fccfe6d046c6..d538f8aa8203c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2271,7 +2271,7 @@ static struct folio *alloc_surplus_hugetlb_folio(struct hstate *h, * as surplus_pages, otherwise it might confuse * persistent_huge_pages() momentarily. */ - __prep_account_new_huge_page(h, nid); + __prep_account_new_huge_page(h, folio_nid(folio)); /* * We could have raced with the pool size change.
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: 2273dea6b1e1 ("mm/hugetlb: update nr_huge_pages and surplus_huge_pages together") Signed-off-by: Liu Shixin <liushixin2@huawei.com> --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)