On Wed, Jun 08, 2011 at 08:45:38AM +0900, KAMEZAWA Hiroyuki wrote: > On Tue, 7 Jun 2011 12:26:11 +0200 > Johannes Weiner <hannes@xxxxxxxxxxx> wrote: > > > On Tue, Jun 07, 2011 at 04:55:37PM +0900, KAMEZAWA Hiroyuki wrote: > > > On Tue, 7 Jun 2011 09:51:31 +0200 > > > Johannes Weiner <hannes@xxxxxxxxxxx> wrote: > > > > @@ -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. > > > > Assume a host with node layout > > N0 | N1 | N2 | N3 | N4 | N0 > > > pages for all node will be allocated onto node-0. That makes sense, thanks for the explanation! -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx 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@xxxxxxxxx"> email@xxxxxxxxx </a>