| From: |
| KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> |
| To: |
| "linux-mm@kvack.org" <linux-mm@kvack.org> |
| Subject: |
| [RFC] [PATCH 0/7 v2] memcg: page_cgroup diet |
| Date: |
| Fri, 13 Jan 2012 17:30:01 +0900 |
| Message-ID: |
| <20120113173001.ee5260ca.kamezawa.hiroyu@jp.fujitsu.com> |
| Cc: |
| Ying Han <yinghan@google.com>, "hugh.dickins@tiscali.co.uk"
<hugh.dickins@tiscali.co.uk>, "hannes@cmpxchg.org" <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>, cgroups@vger.kernel.org,
"bsingharora@gmail.com" <bsingharora@gmail.com> |
| Archive-link: |
| Article, Thread
|
This is just an RFC for dumping my queue to share and get better idea.
Patch order may not be clean. Advice is welcomed.
Now, struct page_cgroup is defined as
==
struct page_cgroup {
unsigned long flags;
struct mem_cgroup *mem_cgroup;
};
==
We want to remove ->flags to shrink the size (and integrate into 'struct page').
To do that, we need to remove some flags.
Now, flag is defined as
==
PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
PCG_CACHE, /* charged as cache */
PCG_USED, /* this object is in use. */
PCG_MIGRATION, /* under page migration */
/* flags for mem_cgroup and file and I/O status */
PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
PCG_FILE_MAPPED, /* page is accounted as "mapped" */
==
We have 6bits now.
This patch series removes PCG_CACHE, PCG_MOVE_LOCK, PCG_FILE_MAPPED.
Then, if we use low 3bits of ->mem_cgroup for PCG_LOCK, PCG_USED, PCG_MIGRATION,
we can remove pc->flags, I guess.
To remove flags, this patch modifes page-stat accounting. After this set,
per-memcg page stat accounting will be
mem_cgroup_begin_update_page_stat() --(A)
modify page status
mem_cgroup_update_page_stat()
mem_cgroup_end_update_page_stat() --(B)
Between (A) and (B), it's guaranteed the page's pc->mem_cgroup will not be moved.
By this change, move_account() can make use of page's information rather than
page_cgroup's flag and we don't have to duplicate flags in page_cgroup.
I think this is saner and allow us to add more per-memcg vmstat without any
new flags.
I'm now testing but don't see additional overheads.
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>