Re: [Bugme-new] [Bug 36192] New: Kernel panic when boot the 2.6.39+ kernel based off of 2.6.32 kernel
From: Johannes Weiner <hannes@cmpxchg.org>
Date: 2011-06-07 10:26:29
On Tue, Jun 07, 2011 at 04:55:37PM +0900, KAMEZAWA Hiroyuki wrote:
On Tue, 7 Jun 2011 09:51:31 +0200 Johannes Weiner [off-list ref] wrote:quoted
@@ -283,23 +285,30 @@ static int __meminit page_cgroup_callback(struct notifier_block *self, void __init page_cgroup_init(void) { - unsigned long pfn; - int fail = 0; + pg_data_t *pgdat; if (mem_cgroup_disabled()) return; - for (pfn = 0; !fail && pfn < max_pfn; pfn += PAGES_PER_SECTION) { - if (!pfn_present(pfn)) - continue; - fail = init_section_page_cgroup(pfn); - } - if (fail) { - printk(KERN_CRIT "try 'cgroup_disable=memory' boot option\n"); - panic("Out of memory"); - } else { - hotplug_memory_notifier(page_cgroup_callback, 0); + for_each_online_pgdat(pgdat) { + unsigned long start; + unsigned long end; + unsigned long pfn; + + start = pgdat->node_start_pfn & ~(PAGES_PER_SECTION - 1); + end = ALIGN(pgdat->node_start_pfn + pgdat->node_spanned_pages, + PAGES_PER_SECTION); + for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { + if (!pfn_present(pfn)) + continue; + if (!init_section_page_cgroup(pgdat->node_id, pfn)) + continue;AFAIK, nodes can overlap. So, this [start, end) scan doesn't work. sections may be initizalised mulitple times ...in wrong way. At here, what we can trust is nid in page->flags or early_node_map[]?.
Sections are not be initialized multiple times. Once their page_cgroup array is allocated they are skipped if considered again later. Second, even if there are two nodes backing the memory of a single section, there is still just a single page_cgroup array per section, we have to take the memory from one node or the other. So if both node N1 and N2 fall into section SN, SN->page_cgroup will be an array of page_cgroup structures, allocated on N1, to represent the pages of SN. The first section considered when walking the PFNs of N2 will be SN, which will be skipped because of !!SN->page_cgroup. I do not see the problem. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>