Merge branch 'fixes' into for-next

This commit is contained in:
Mike Rapoport (Microsoft) 2026-08-07 11:45:58 +03:00
commit 697c969b9c
3 changed files with 22 additions and 11 deletions

View File

@ -289,7 +289,7 @@ static inline void __remove_memory(u64 start, u64 size) {}
/* Default online_type (MMOP_*) when new memory blocks are added. */
extern enum mmop mhp_get_default_online_type(void);
extern void mhp_set_default_online_type(enum mmop online_type);
extern void __ref free_area_init_core_hotplug(struct pglist_data *pgdat);
int __ref free_area_init_core_hotplug(struct pglist_data *pgdat);
extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
extern int add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
extern int add_memory_resource(int nid, struct resource *resource,

View File

@ -1263,7 +1263,8 @@ static pg_data_t *hotadd_init_pgdat(int nid)
pgdat = NODE_DATA(nid);
/* init node's zones as empty zones, we don't have any present pages.*/
free_area_init_core_hotplug(pgdat);
if (free_area_init_core_hotplug(pgdat))
return NULL;
/*
* The node we allocated has no zone fallback lists. For avoiding

View File

@ -1338,7 +1338,7 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
unsigned long node_start_pfn,
unsigned long node_end_pfn)
{
unsigned long realtotalpages = 0, totalpages = 0;
unsigned long realtotalpages = 0;
enum zone_type i;
for (i = 0; i < MAX_NR_ZONES; i++) {
@ -1368,11 +1368,10 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
zone->present_early_pages = real_size;
#endif
totalpages += spanned;
realtotalpages += real_size;
}
pgdat->node_spanned_pages = totalpages;
pgdat->node_spanned_pages = node_end_pfn - node_start_pfn;
pgdat->node_present_pages = realtotalpages;
pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages);
}
@ -1536,7 +1535,7 @@ void __init set_pageblock_order(void)
* NOTE: this function is only called during memory hotplug
*/
#ifdef CONFIG_MEMORY_HOTPLUG
void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
int __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
{
int nid = pgdat->node_id;
enum zone_type z;
@ -1544,8 +1543,14 @@ void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
pgdat_init_internals(pgdat);
if (pgdat->per_cpu_nodestats == &boot_nodestats)
pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat);
if (pgdat->per_cpu_nodestats == &boot_nodestats) {
struct per_cpu_nodestat __percpu *p;
p = alloc_percpu(struct per_cpu_nodestat);
if (!p)
return -ENOMEM;
pgdat->per_cpu_nodestats = p;
}
/*
* Reset the nr_zones, order and highest_zoneidx before reuse.
@ -1576,6 +1581,8 @@ void __ref free_area_init_core_hotplug(struct pglist_data *pgdat)
zone->present_pages = 0;
zone_init_internals(zone, z, nid, 0);
}
return 0;
}
#endif
@ -2207,10 +2214,13 @@ bool __init deferred_grow_zone(struct zone *zone, unsigned int order)
}
/*
* There were no pages to initialize and free which means the zone's
* memory map is completely initialized.
* The loop only tests spfn before entering an iteration, so on exit it
* may point up to a section past the end of the zone. When it does,
* the rest of the zone has already been handed to
* deferred_init_memmap_chunk() and nothing is left to initialize.
*/
pgdat->first_deferred_pfn = nr_pages ? spfn : ULONG_MAX;
pgdat->first_deferred_pfn =
spfn < zone_end_pfn(zone) ? spfn : ULONG_MAX;
pgdat_resize_unlock(pgdat, &flags);