From: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
To: Suleiman Souhlal <suleiman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Han Ying <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
"Aneesh Kumar K.V"
<aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ@public.gmane.org,
khlebnikov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC][PATCH 2/3] memcg: reduce size of struct page_cgroup.
Date: Wed, 21 Mar 2012 09:47:29 +0900 [thread overview]
Message-ID: <4F692521.8010607@jp.fujitsu.com> (raw)
In-Reply-To: <CABCjUKAr+F=Pz-JCWfjGfyL4AcHt6m97p13=0VdwjeVm5SKW7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
(2012/03/20 7:20), Suleiman Souhlal wrote:
> 2012/3/19 KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>:
>> Now, page_cgroup->flags has only 3bits. Considering alignment of
>> struct mem_cgroup, which is allocated by kmalloc(), we can encode
>> pointer to mem_cgroup and flags into a word.
>>
>> After this patch, pc->flags is encoded as
>>
>> 63 2 0
>> | pointer to memcg..........|flags|
>>
>> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
>> ---
>> include/linux/page_cgroup.h | 15 ++++++++++++---
>> 1 files changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
>> index 92768cb..bca5447 100644
>> --- a/include/linux/page_cgroup.h
>> +++ b/include/linux/page_cgroup.h
>> @@ -1,6 +1,10 @@
>> #ifndef __LINUX_PAGE_CGROUP_H
>> #define __LINUX_PAGE_CGROUP_H
>>
>> +/*
>> + * Because these flags are encoded into ->flags with a pointer,
>> + * we cannot have too much flags.
>> + */
>> enum {
>> /* flags for mem_cgroup */
>> PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
>> @@ -9,6 +13,8 @@ enum {
>> __NR_PCG_FLAGS,
>> };
>>
>> +#define PCG_FLAGS_MASK ((1 << __NR_PCG_FLAGS) - 1)
>> +
>> #ifndef __GENERATING_BOUNDS_H
>> #include <generated/bounds.h>
>>
>> @@ -21,10 +27,12 @@ enum {
>> * page_cgroup helps us identify information about the cgroup
>> * All page cgroups are allocated at boot or memory hotplug event,
>> * then the page cgroup for pfn always exists.
>> + *
>> + * flags and a pointer to memory cgroup are encoded into ->flags.
>> + * Lower 3bits are used for flags and others are used for a pointer to memcg.
>
> Would it be worth adding a BUILD_BUG_ON(__NR_PCG_FLAGS > 3) ?
>
Ok, I'll add that.
Thanks,
-Kame
WARNING: multiple messages have this Message-ID (diff)
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Suleiman Souhlal <suleiman@google.com>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>, Hugh Dickins <hughd@google.com>,
Han Ying <yinghan@google.com>,
Glauber Costa <glommer@parallels.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
n-horiguchi@ah.jp.nec.com, khlebnikov@openvz.org,
Tejun Heo <tj@kernel.org>
Subject: Re: [RFC][PATCH 2/3] memcg: reduce size of struct page_cgroup.
Date: Wed, 21 Mar 2012 09:47:29 +0900 [thread overview]
Message-ID: <4F692521.8010607@jp.fujitsu.com> (raw)
In-Reply-To: <CABCjUKAr+F=Pz-JCWfjGfyL4AcHt6m97p13=0VdwjeVm5SKW7w@mail.gmail.com>
(2012/03/20 7:20), Suleiman Souhlal wrote:
> 2012/3/19 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>:
>> Now, page_cgroup->flags has only 3bits. Considering alignment of
>> struct mem_cgroup, which is allocated by kmalloc(), we can encode
>> pointer to mem_cgroup and flags into a word.
>>
>> After this patch, pc->flags is encoded as
>>
>> 63 2 0
>> | pointer to memcg..........|flags|
>>
>> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>> ---
>> include/linux/page_cgroup.h | 15 ++++++++++++---
>> 1 files changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
>> index 92768cb..bca5447 100644
>> --- a/include/linux/page_cgroup.h
>> +++ b/include/linux/page_cgroup.h
>> @@ -1,6 +1,10 @@
>> #ifndef __LINUX_PAGE_CGROUP_H
>> #define __LINUX_PAGE_CGROUP_H
>>
>> +/*
>> + * Because these flags are encoded into ->flags with a pointer,
>> + * we cannot have too much flags.
>> + */
>> enum {
>> /* flags for mem_cgroup */
>> PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
>> @@ -9,6 +13,8 @@ enum {
>> __NR_PCG_FLAGS,
>> };
>>
>> +#define PCG_FLAGS_MASK ((1 << __NR_PCG_FLAGS) - 1)
>> +
>> #ifndef __GENERATING_BOUNDS_H
>> #include <generated/bounds.h>
>>
>> @@ -21,10 +27,12 @@ enum {
>> * page_cgroup helps us identify information about the cgroup
>> * All page cgroups are allocated at boot or memory hotplug event,
>> * then the page cgroup for pfn always exists.
>> + *
>> + * flags and a pointer to memory cgroup are encoded into ->flags.
>> + * Lower 3bits are used for flags and others are used for a pointer to memcg.
>
> Would it be worth adding a BUILD_BUG_ON(__NR_PCG_FLAGS > 3) ?
>
Ok, I'll add that.
Thanks,
-Kame
--
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>
next prev parent reply other threads:[~2012-03-21 0:47 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 7:56 [RFC][PATCH 0/3] page cgroup diet KAMEZAWA Hiroyuki
2012-03-19 7:59 ` [RFC][PATCH 1/3] memcg: add methods to access pc->mem_cgroup KAMEZAWA Hiroyuki
2012-03-19 10:58 ` Glauber Costa
[not found] ` <4F671138.3000508-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-03-19 12:11 ` KAMEZAWA Hiroyuki
2012-03-19 12:11 ` KAMEZAWA Hiroyuki
2012-03-19 12:29 ` Glauber Costa
2012-03-19 15:33 ` Michal Hocko
2012-03-19 15:33 ` Michal Hocko
2012-03-19 15:34 ` Glauber Costa
[not found] ` <20120319153334.GC31213-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2012-03-21 1:06 ` KAMEZAWA Hiroyuki
2012-03-21 1:06 ` KAMEZAWA Hiroyuki
[not found] ` <4F66E773.4000807-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-22 13:11 ` Michal Hocko
2012-03-22 13:11 ` Michal Hocko
2012-03-19 8:01 ` [RFC][PATCH 2/3] memcg: reduce size of struct page_cgroup KAMEZAWA Hiroyuki
2012-03-19 22:20 ` Suleiman Souhlal
[not found] ` <CABCjUKAr+F=Pz-JCWfjGfyL4AcHt6m97p13=0VdwjeVm5SKW7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-21 0:47 ` KAMEZAWA Hiroyuki [this message]
2012-03-21 0:47 ` KAMEZAWA Hiroyuki
[not found] ` <4F66E7D7.4040406-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-22 13:11 ` Michal Hocko
2012-03-22 13:11 ` Michal Hocko
[not found] ` <4F66E6A5.10804-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-19 8:03 ` [RFC][PATCH 3/3] memcg: atomic update of memcg pointer and other bits KAMEZAWA Hiroyuki
2012-03-19 8:03 ` KAMEZAWA Hiroyuki
2012-03-22 13:38 ` Michal Hocko
2012-03-23 1:03 ` KAMEZAWA Hiroyuki
2012-03-23 8:54 ` Michal Hocko
2012-03-19 19:59 ` [RFC][PATCH 0/3] page cgroup diet Konstantin Khlebnikov
2012-03-19 19:59 ` Konstantin Khlebnikov
[not found] ` <4F679039.6070609-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2012-03-21 1:02 ` KAMEZAWA Hiroyuki
2012-03-21 1:02 ` KAMEZAWA Hiroyuki
[not found] ` <4F692895.8020908-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-21 6:13 ` Konstantin Khlebnikov
2012-03-21 6:13 ` Konstantin Khlebnikov
[not found] ` <4F69718E.8010603-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2012-03-21 6:30 ` KAMEZAWA Hiroyuki
2012-03-21 6:30 ` KAMEZAWA Hiroyuki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F692521.8010607@jp.fujitsu.com \
--to=kamezawa.hiroyu-+cum20s59erqfuhtdcdx3a@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=khlebnikov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
--cc=n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ@public.gmane.org \
--cc=suleiman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.