diff options
author | David Hildenbrand <[email protected]> | 2020-10-15 20:08:03 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2020-10-16 11:11:17 -0700 |
commit | ea15153c3d46777be28d84c1484ad80a9e119234 (patch) | |
tree | 5deb7cddf5f8fdf9954281d08ee9e94beecabf3b | |
parent | 257bea71582d895894201b604990a900df489103 (diff) |
mm/memory_hotplug: drop nr_isolate_pageblock in offline_pages()
We make sure that we cannot have any memory holes right at the beginning
of offline_pages() and we only support to online/offline full sections.
Both, sections and pageblocks are a power of two in size, and sections
always span full pageblocks.
We can directly calculate the number of isolated pageblocks from nr_pages.
Signed-off-by: David Hildenbrand <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Wei Yang <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Pankaj Gupta <[email protected]>
Cc: Charan Teja Reddy <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Logan Gunthorpe <[email protected]>
Cc: "Matthew Wilcox (Oracle)" <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Michel Lespinasse <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Tony Luck <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/memory_hotplug.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index c3977ce28061..90524446aafd 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1471,10 +1471,10 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages) { const unsigned long end_pfn = start_pfn + nr_pages; unsigned long pfn, system_ram_pages = 0; - int ret, node, nr_isolate_pageblock; unsigned long flags; struct zone *zone; struct memory_notify arg; + int ret, node; char *reason; /* We can only offline full sections (e.g., SECTION_IS_ONLINE) */ @@ -1518,7 +1518,6 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages) reason = "failure to isolate range"; goto failed_removal; } - nr_isolate_pageblock = ret; arg.start_pfn = start_pfn; arg.nr_pages = nr_pages; @@ -1596,7 +1595,7 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages) * pageblocks zone counter here. */ spin_lock_irqsave(&zone->lock, flags); - zone->nr_isolate_pageblock -= nr_isolate_pageblock; + zone->nr_isolate_pageblock -= nr_pages / pageblock_nr_pages; spin_unlock_irqrestore(&zone->lock, flags); /* removal success */ |