diff options
-rw-r--r-- | mm/memcontrol.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e2996b80601f..b66512771167 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -358,6 +358,10 @@ void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru) | |||
358 | return; | 358 | return; |
359 | 359 | ||
360 | pc = lookup_page_cgroup(page); | 360 | pc = lookup_page_cgroup(page); |
361 | /* | ||
362 | * Used bit is set without atomic ops but after smp_wmb(). | ||
363 | * For making pc->mem_cgroup visible, insert smp_rmb() here. | ||
364 | */ | ||
361 | smp_rmb(); | 365 | smp_rmb(); |
362 | /* unused page is not rotated. */ | 366 | /* unused page is not rotated. */ |
363 | if (!PageCgroupUsed(pc)) | 367 | if (!PageCgroupUsed(pc)) |
@@ -374,7 +378,10 @@ void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru) | |||
374 | if (mem_cgroup_disabled()) | 378 | if (mem_cgroup_disabled()) |
375 | return; | 379 | return; |
376 | pc = lookup_page_cgroup(page); | 380 | pc = lookup_page_cgroup(page); |
377 | /* barrier to sync with "charge" */ | 381 | /* |
382 | * Used bit is set without atomic ops but after smp_wmb(). | ||
383 | * For making pc->mem_cgroup visible, insert smp_rmb() here. | ||
384 | */ | ||
378 | smp_rmb(); | 385 | smp_rmb(); |
379 | if (!PageCgroupUsed(pc)) | 386 | if (!PageCgroupUsed(pc)) |
380 | return; | 387 | return; |
@@ -559,6 +566,14 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page) | |||
559 | return NULL; | 566 | return NULL; |
560 | 567 | ||
561 | pc = lookup_page_cgroup(page); | 568 | pc = lookup_page_cgroup(page); |
569 | /* | ||
570 | * Used bit is set without atomic ops but after smp_wmb(). | ||
571 | * For making pc->mem_cgroup visible, insert smp_rmb() here. | ||
572 | */ | ||
573 | smp_rmb(); | ||
574 | if (!PageCgroupUsed(pc)) | ||
575 | return NULL; | ||
576 | |||
562 | mz = page_cgroup_zoneinfo(pc); | 577 | mz = page_cgroup_zoneinfo(pc); |
563 | if (!mz) | 578 | if (!mz) |
564 | return NULL; | 579 | return NULL; |