mm/memory_hotplug: Remove move_pfn_range()
Subsystems (2)
PATCH 1/1 mm/memory_hotplug: Remove move_pfn_range()
Let's remove this indirection. We need the zone in the caller either way, so let's just detect it there. Add some documentation for move_pfn_range_to_zone() instead.
--- mm/memory_hotplug.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
mm/memory_hotplug.c +7 -16
@@ -715,7 +715,11 @@ static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon pgdat->node_spanned_pages =max (start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn; } - +/* +* Associate the pfn range with the given zone, initializing the memmaps +* and resizing the pgdat/zone data to span the added pages. After this +* call, all affected pages are PG_reserved. +*/ void __ref move_pfn_range_to_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages,struct vmem_altmap *altmap) {
@@ -804,20 +808,6 @@ struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,return default_zone_for_pfn (nid, start_pfn, nr_pages); } -/* -* Associates the given pfn range with the given node and the zone appropriate -* for the given online type. -*/ -static struct zone *__meminit move_pfn_range (int online_type,int nid, -unsigned long start_pfn,unsigned long nr_pages) -{ -struct zone *zone; - - zone =zone_for_pfn_range (online_type, nid, start_pfn, nr_pages); -move_pfn_range_to_zone (zone, start_pfn, nr_pages,NULL ); -return zone; -} -int __ref online_pages (unsigned long pfn,unsigned long nr_pages,int online_type) {unsigned long flags;
@@ -840,7 +830,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typput_device (&mem->dev);/* associate pfn range with the zone */ - zone =move_pfn_range (online_type, nid, pfn, nr_pages); + zone =zone_for_pfn_range (online_type, nid, pfn, nr_pages); +move_pfn_range_to_zone (zone, pfn, nr_pages,NULL ); arg.start_pfn = pfn; arg.nr_pages = nr_pages;
Signature · 1 line
2.21.0
Quoted 11 lines · David Hildenbrand
Let's remove this indirection. We need the zone in the caller either way, so let's just detect it there. Add some documentation for
move_pfn_range_to_zone()instead.Cc Andrew Morton <[email protected]>Cc Oscar Salvador <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Quoted 54 lines
--- mm/memory_hotplug.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)mm/memory_hotplug.c +7
-16@@ -715,7 +715,11 @@ static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon pgdat->node_spanned_pages =max (start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn; } - +/* +* Associate the pfn range with the given zone, initializing the memmaps +* and resizing the pgdat/zone data to span the added pages. After this +* call, all affected pages are PG_reserved. +*/ void __ref move_pfn_range_to_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages,struct vmem_altmap *altmap) {@@ -804,20 +808,6 @@ struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,return default_zone_for_pfn (nid, start_pfn, nr_pages); } -/* -* Associates the given pfn range with the given node and the zone appropriate -* for the given online type. -*/ -static struct zone *__meminit move_pfn_range (int online_type,int nid, -unsigned long start_pfn,unsigned long nr_pages) -{ -struct zone *zone; - - zone =zone_for_pfn_range (online_type, nid, start_pfn, nr_pages); -move_pfn_range_to_zone (zone, start_pfn, nr_pages,NULL ); -return zone; -} -int __ref online_pages (unsigned long pfn,unsigned long nr_pages,int online_type) {unsigned long flags;@@ -840,7 +830,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typput_device (&mem->dev);/* associate pfn range with the zone */ - zone =move_pfn_range (online_type, nid, pfn, nr_pages); + zone =zone_for_pfn_range (online_type, nid, pfn, nr_pages); +move_pfn_range_to_zone (zone, pfn, nr_pages,NULL ); arg.start_pfn = pfn; arg.nr_pages = nr_pages;Signature · 1 line
2.21.0
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 20 lines · David Hildenbrand
Let's remove this indirection. We need the zone in the caller either way, so let's just detect it there. Add some documentation for
move_pfn_range_to_zone()instead.Cc Andrew Morton <[email protected]>Cc Oscar Salvador <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- mm/memory_hotplug.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)mm/memory_hotplug.c +0
-0
mm/memory_hotplug.c static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon · line 718
Quoted 4 lines
mm/memory_hotplug.c +0
-1@@ -715,7 +715,11 @@ static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon pgdat->node_spanned_pages =max (start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn; } -
^ whoops, deleted this empty line by mistake - it should stay of course. Can resend.
Quoted 40 lines
mm/memory_hotplug.c +7
-15+/* +* Associate the pfn range with the given zone, initializing the memmaps +* and resizing the pgdat/zone data to span the added pages. After this +* call, all affected pages are PG_reserved. +*/ void __ref move_pfn_range_to_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages,struct vmem_altmap *altmap) {@@ -804,20 +808,6 @@ struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,return default_zone_for_pfn (nid, start_pfn, nr_pages); } -/* -* Associates the given pfn range with the given node and the zone appropriate -* for the given online type. -*/ -static struct zone *__meminit move_pfn_range (int online_type,int nid, -unsigned long start_pfn,unsigned long nr_pages) -{ -struct zone *zone; - - zone =zone_for_pfn_range (online_type, nid, start_pfn, nr_pages); -move_pfn_range_to_zone (zone, start_pfn, nr_pages,NULL ); -return zone; -} -int __ref online_pages (unsigned long pfn,unsigned long nr_pages,int online_type) {unsigned long flags;@@ -840,7 +830,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typput_device (&mem->dev);/* associate pfn range with the zone */ - zone =move_pfn_range (online_type, nid, pfn, nr_pages); + zone =zone_for_pfn_range (online_type, nid, pfn, nr_pages); +move_pfn_range_to_zone (zone, pfn, nr_pages,NULL ); arg.start_pfn = pfn; arg.nr_pages = nr_pages;
Signature · 3 lines
Thanks, David / dhildenb
Quoted 11 lines · David Hildenbrand
Let's remove this indirection. We need the zone in the caller either way, so let's just detect it there. Add some documentation for
move_pfn_range_to_zone()instead.Cc Andrew Morton <[email protected]>Cc Oscar Salvador <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Quoted 55 lines
--- mm/memory_hotplug.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)mm/memory_hotplug.c +7
-16@@ -715,7 +715,11 @@ static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon pgdat->node_spanned_pages =max (start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn; } - +/* +* Associate the pfn range with the given zone, initializing the memmaps +* and resizing the pgdat/zone data to span the added pages. After this +* call, all affected pages are PG_reserved. +*/ void __ref move_pfn_range_to_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages,struct vmem_altmap *altmap) {@@ -804,20 +808,6 @@ struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn,return default_zone_for_pfn (nid, start_pfn, nr_pages); } -/* -* Associates the given pfn range with the given node and the zone appropriate -* for the given online type. -*/ -static struct zone *__meminit move_pfn_range (int online_type,int nid, -unsigned long start_pfn,unsigned long nr_pages) -{ -struct zone *zone; - - zone =zone_for_pfn_range (online_type, nid, start_pfn, nr_pages); -move_pfn_range_to_zone (zone, start_pfn, nr_pages,NULL ); -return zone; -} -int __ref online_pages (unsigned long pfn,unsigned long nr_pages,int online_type) {unsigned long flags;@@ -840,7 +830,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typput_device (&mem->dev);/* associate pfn range with the zone */ - zone =move_pfn_range (online_type, nid, pfn, nr_pages); + zone =zone_for_pfn_range (online_type, nid, pfn, nr_pages); +move_pfn_range_to_zone (zone, pfn, nr_pages,NULL ); arg.start_pfn = pfn; arg.nr_pages = nr_pages;Signature · 1 line
2.21.0
Signature · 2 lines
Oscar Salvador SUSE L3