Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/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>

authored by

Liu Shixin and committed by
Andrew Morton
382360d2 c5bb27e2

+1 -1
+1 -1
mm/hugetlb.c
··· 2271 2271 * as surplus_pages, otherwise it might confuse 2272 2272 * persistent_huge_pages() momentarily. 2273 2273 */ 2274 - __prep_account_new_huge_page(h, nid); 2274 + __prep_account_new_huge_page(h, folio_nid(folio)); 2275 2275 2276 2276 /* 2277 2277 * We could have raced with the pool size change.