Thread (21 messages) 21 messages, 5 authors, 2012-03-23

Re: [RFC][PATCH 2/3] memcg: reduce size of struct page_cgroup.

From: Michal Hocko <hidden>
Date: 2012-03-22 13:11:20
Also in: cgroups

On Mon 19-03-12 17:01:27, KAMEZAWA Hiroyuki wrote:
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.
                                  into a single word.
After this patch, pc->flags is encoded as

 63                           2     0
  | pointer to memcg..........|flags|
Looks good.
Acked-by: Michal Hocko <redacted>
quoted hunk ↗ jump to hunk
Signed-off-by: KAMEZAWA Hiroyuki <redacted>
---
 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.
                     ^^^^^^^^^^^^^^ 
cannot have too many flags 
but an explicit BUILD_BUG_ON would be much more precise than a comment I
guess.

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help