aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2012-07-31 19:46:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 21:42:50 -0400
commit88fdf75d1bb51d85ba00c466391770056d44bc03 (patch)
tree0b4f6d9b9c0fb39fd03199c6b19ae626608b2fbb /mm/page_alloc.c
parent93180cec0064d072a984f91c429c5e6bcc816976 (diff)
mm: warn if pg_data_t isn't initialized with zero
Warn if memory-hotplug/boot code doesn't initialize pg_data_t with zero when it is allocated. Arch code and memory hotplug already initiailize pg_data_t. So this warning should never happen. I select fields randomly near the beginning, middle and end of pg_data_t for checking. This patch isn't for performance but for removing initialization code which is necessary to add whenever we adds new field to pg_data_t or zone. Firstly, Andrew suggested clearing out of pg_data_t in MM core part but Tejun doesn't like it because in the future, some archs can initialize some fields in arch code and pass them into general MM part so blindly clearing it out in mm core part would be very annoying. Signed-off-by: Minchan Kim <minchan@kernel.org> Cc: Tejun Heo <tj@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 48aee0f5902f..a6f7576aecae 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4515,6 +4515,9 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
4515{ 4515{
4516 pg_data_t *pgdat = NODE_DATA(nid); 4516 pg_data_t *pgdat = NODE_DATA(nid);
4517 4517
4518 /* pg_data_t should be reset to zero when it's allocated */
4519 WARN_ON(pgdat->nr_zones || pgdat->node_start_pfn || pgdat->classzone_idx);
4520
4518 pgdat->node_id = nid; 4521 pgdat->node_id = nid;
4519 pgdat->node_start_pfn = node_start_pfn; 4522 pgdat->node_start_pfn = node_start_pfn;
4520 calculate_node_totalpages(pgdat, zones_size, zholes_size); 4523 calculate_node_totalpages(pgdat, zones_size, zholes_size);