aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorLiu Shixin <[email protected]>2025-04-03 06:41:38 +0000
committerAndrew Morton <[email protected]>2025-04-12 00:32:36 +0000
commit382360d289c1e1d89df06f33c4d5b874b38ef267 (patch)
treef3636601b90e9da3e7126b051b0f05d6f699d3b4 /mm/hugetlb.c
parentmm/page_alloc: avoid second trylock of zone->lock (diff)
downloadkernel-382360d289c1e1d89df06f33c4d5b874b38ef267.tar.gz
kernel-382360d289c1e1d89df06f33c4d5b874b38ef267.zip
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: 2273dea6b1e1 ("mm/hugetlb: update nr_huge_pages and surplus_huge_pages together") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Liu Shixin <[email protected]> Acked-by: Oscar Salvador <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Kefeng Wang <[email protected]> Cc: Muchun Song <[email protected]> Cc: Nanyong Sun <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 39f92aad7bd1..6670f9b9e07a 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.