Re: [PATCH] memcgroup: check and initialize page->cgroup inmemmap_init_zone

From: KAMEZAWA Hiroyuki
Date: Thu Apr 17 2008 - 23:13:19 EST


On Fri, 18 Apr 2008 10:46:30 +0800
Shi Weihua <shiwh@xxxxxxxxxxxxxx> wrote:

> In this patch, the Author Hugh Dickins said
> "...memmap_init_zone doesn't need it either, ...
> Linux assumes pointers in zeroed structures are NULL pointers."
> But it seems it's not always the case, so we should check and initialize
> page->cgroup anyways.
>
Hmm...strange. (I never see this with 2.6.25 + Primequest)
What memory model are you using ? CONFIG_SPRASEMEM_VMEMMAP ?


> for (pfn = start_pfn; pfn < end_pfn; pfn++) {
> /*
> @@ -2535,6 +2536,9 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
> set_page_links(page, zone, nid, pfn);
> init_page_count(page);
> reset_page_mapcount(page);
> + pc = page_get_page_cgroup(page);
> + if (pc)
> + page_reset_bad_cgroup(page);
> SetPageReserved(page);
>
BTW, page_reset_page_cgroup, defined as this
==
#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
==
Should be
==
#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0UL)
==
...I'll write a patch.

Thanks,
-Kame


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/