diff options
-rw-r--r-- | mm/memcontrol.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b0757660663f..eb9571815f0c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1134,6 +1134,13 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *mem, | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | pc->mem_cgroup = mem; | 1136 | pc->mem_cgroup = mem; |
1137 | /* | ||
1138 | * We access a page_cgroup asynchronously without lock_page_cgroup(). | ||
1139 | * Especially when a page_cgroup is taken from a page, pc->mem_cgroup | ||
1140 | * is accessed after testing USED bit. To make pc->mem_cgroup visible | ||
1141 | * before USED bit, we need memory barrier here. | ||
1142 | * See mem_cgroup_add_lru_list(), etc. | ||
1143 | */ | ||
1137 | smp_wmb(); | 1144 | smp_wmb(); |
1138 | switch (ctype) { | 1145 | switch (ctype) { |
1139 | case MEM_CGROUP_CHARGE_TYPE_CACHE: | 1146 | case MEM_CGROUP_CHARGE_TYPE_CACHE: |