Skip to content

Commit

Permalink
mm/page_alloc: add a VM_BUG in __free_one_page() if the zone is unini…
Browse files Browse the repository at this point in the history
…tialized.

Freeing pages to uninitialized zones is not handled by
__free_one_page(), and should never happen when the code is correct.

Ran into this while writing some code that dynamically onlines extra
zones.

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: David Hansen <dave@linux.vnet.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Cody P Schafer authored and Linus Torvalds committed Feb 24, 2013
1 parent 2a6e3eb commit d29bb97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ static inline void __free_one_page(struct page *page,
unsigned long uninitialized_var(buddy_idx);
struct page *buddy;

VM_BUG_ON(!zone_is_initialized(zone));

if (unlikely(PageCompound(page)))
if (unlikely(destroy_compound_page(page, order)))
return;
Expand Down

0 comments on commit d29bb97

Please sign in to comment.