Skip to content

Commit

Permalink
memory hotplug: release memory regions in PAGES_PER_SECTION chunks
Browse files Browse the repository at this point in the history
During hotplug memory remove, memory regions should be released on a
PAGES_PER_SECTION size chunks.  This mirrors the code in add_memory where
resources are requested on a PAGES_PER_SECTION size.

Attempting to release the entire memory region fails because there is not
a single resource for the total number of pages being removed.  Instead
the resources for the pages are split in PAGES_PER_SECTION size chunks as
requested during memory add.

Signed-off-by: Nathan Fontenot <[email protected]>
Signed-off-by: Badari Pulavarty <[email protected]>
Acked-by: Yasunori Goto <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Nathan Fontenot authored and torvalds committed Oct 20, 2008
1 parent 7a6560e commit de7f0cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
BUG_ON(nr_pages % PAGES_PER_SECTION);

release_mem_region(phys_start_pfn << PAGE_SHIFT, nr_pages * PAGE_SIZE);

sections_to_remove = nr_pages / PAGES_PER_SECTION;
for (i = 0; i < sections_to_remove; i++) {
unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
release_mem_region(pfn << PAGE_SHIFT,
PAGES_PER_SECTION << PAGE_SHIFT);
ret = __remove_section(zone, __pfn_to_section(pfn));
if (ret)
break;
Expand Down

0 comments on commit de7f0cb

Please sign in to comment.