From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K.V" Subject: Re: [PATCH -V7 07/14] mm/page_cgroup: Make page_cgroup point to the cgroup rather than the mem_cgroup Date: Fri, 08 Jun 2012 00:35:00 +0530 Message-ID: <87sje72bab.fsf@skywalker.in.ibm.com> References: <1338388739-22919-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1338388739-22919-8-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <4FCD648E.90709@jp.fujitsu.com> <87ehpu8o5z.fsf@skywalker.in.ibm.com> <4FCD7FBB.1000304@jp.fujitsu.com>User-Agent: Notmuch/0.11.1+346~g13d19c3 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Mime-Version: 1.0 Return-path: In-Reply-To: <4FCD7FBB.1000304-+CUm20s59erQFUHtdCDX3A@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Kamezawa Hiroyuki Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, dhillf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, mhocko-AlSwsSmVLrQ@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Kamezawa Hiroyuki writes: > You can use other pages than head/tails. > For example,I think you have 512 pages per 2M pages. How about the below. This limit the usage to hugetlb cgroup to only hugepages with more than 3 normal pages. I guess that is an acceptable limitation. static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page) { if (!PageHuge(page)) return NULL; if (compound_order(page) < 3) return NULL; return (struct hugetlb_cgroup *)page[2].lru.next; } static inline int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg) { if (!PageHuge(page)) return -1; if (compound_order(page) < 3) return -1; page[2].lru.next = (void *)h_cg; return 0; } -aneesh