]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm/page_alloc: add a VM_BUG in __free_one_page() if the zone is uninitialized.
authorCody P Schafer <cody@linux.vnet.ibm.com>
Thu, 7 Feb 2013 01:27:05 +0000 (12:27 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:46:50 +0000 (16:46 +1100)
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>
mm/page_alloc.c

index c558decf6bacc1bc241255027780bdd236e0c22c..cde32d2ffb9c60b8aea1834e8cbbb1702a003193 100644 (file)
@@ -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;