|
@@ -1966,10 +1966,6 @@ void mem_cgroup_update_page_stat(struct page *page,
|
|
|
|
|
|
switch (idx) {
|
|
|
case MEMCG_NR_FILE_MAPPED:
|
|
|
- if (val > 0)
|
|
|
- SetPageCgroupFileMapped(pc);
|
|
|
- else if (!page_mapped(page))
|
|
|
- ClearPageCgroupFileMapped(pc);
|
|
|
idx = MEM_CGROUP_STAT_FILE_MAPPED;
|
|
|
break;
|
|
|
default:
|
|
@@ -2617,7 +2613,7 @@ static int mem_cgroup_move_account(struct page *page,
|
|
|
|
|
|
move_lock_mem_cgroup(from, &flags);
|
|
|
|
|
|
- if (PageCgroupFileMapped(pc)) {
|
|
|
+ if (!anon && page_mapped(page)) {
|
|
|
/* Update mapped_file data for mem_cgroup */
|
|
|
preempt_disable();
|
|
|
__this_cpu_dec(from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
|
|
@@ -2982,6 +2978,11 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
|
|
|
|
|
|
switch (ctype) {
|
|
|
case MEM_CGROUP_CHARGE_TYPE_MAPPED:
|
|
|
+ /*
|
|
|
+ * Generally PageAnon tells if it's the anon statistics to be
|
|
|
+ * updated; but sometimes e.g. mem_cgroup_uncharge_page() is
|
|
|
+ * used before page reached the stage of being marked PageAnon.
|
|
|
+ */
|
|
|
anon = true;
|
|
|
/* fallthrough */
|
|
|
case MEM_CGROUP_CHARGE_TYPE_DROP:
|