Re: [RFC] [PATCH 8/9] memcg: remove page_cgroup pointer from memmap

Balbir Singh
2008-09-12T16:13:44Z

KAMEZAWA Hiroyuki wrote:
> Remove page_cgroup pointer from struct page.
>
> This patch removes page_cgroup pointer from struct page and make it be able
> to get from pfn. Then, relationship of them is
>
> Before this:
> pfn <-> struct page <-> struct page_cgroup.
> After this:
> struct page <-> pfn -> struct page_cgroup -> struct page.
>
> Benefit of this approach is we can remove 8(4) bytes from struct page.
>
> Other changes are:
> - lock/unlock_page_cgroup() uses its own bit on struct page_cgroup.
> - all necessary page_cgroups are allocated at boot.
>
> Characteristics:
> - page cgroup is allocated as some amount of chunk.
> This patch uses SECTION_SIZE as size of chunk if 64bit/SPARSEMEM is enabled.
> If not, appropriate default number is selected.
> - all page_cgroup struct is maintained by hash.
> I think we have 2 ways to handle sparse index in general
> ...radix-tree and hash. This uses hash because radix-tree's layout is
> affected by memory map's layout.
> - page_cgroup.h/page_cgroup.c is added.
>
> TODO:
> - memory hotplug support. (not difficult)

Kamezawa,

I feel we can try the following approaches

1. Try per-node per-zone radix tree with dynamic allocation
2. Try the approach you have
3. Integrate with sparsemem (last resort for performance), Dave Hansen suggested
adding a mem_section member and using that.

I am going to try #1 today and see what the performance looks like

--
Balbir