projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b3bde4
)
memcg: add comments explaining memory barriers
author
KAMEZAWA Hiroyuki
<
[email protected]
>
Wed, 23 Sep 2009 22:56:33 +0000
(15:56 -0700)
committer
Linus Torvalds
<
[email protected]
>
Thu, 24 Sep 2009 14:20:58 +0000
(07:20 -0700)
Add comments for the reason of smp_wmb() in mem_cgroup_commit_charge().
[
[email protected]
: coding-style fixes]
Cc: Daisuke Nishimura <
[email protected]
>
Cc: Balbir Singh <
[email protected]
>
Signed-off-by: KAMEZAWA Hiroyuki <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
mm/memcontrol.c
patch
|
blob
|
history
diff --git
a/mm/memcontrol.c
b/mm/memcontrol.c
index b0757660663f47e570208abd18182c44c4e47798..eb9571815f0c0eeb07f60dbeae9abcee35926bf0 100644
(file)
--- a/
mm/memcontrol.c
+++ b/
mm/memcontrol.c
@@
-1134,6
+1134,13
@@
static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
}
pc->mem_cgroup = mem;
+ /*
+ * We access a page_cgroup asynchronously without lock_page_cgroup().
+ * Especially when a page_cgroup is taken from a page, pc->mem_cgroup
+ * is accessed after testing USED bit. To make pc->mem_cgroup visible
+ * before USED bit, we need memory barrier here.
+ * See mem_cgroup_add_lru_list(), etc.
+ */
smp_wmb();
switch (ctype) {
case MEM_CGROUP_CHARGE_TYPE_CACHE: