Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218535
b: refs/heads/master
c: 26174ef
h: refs/heads/master
i:
  218533: c3b5cf8
  218531: 31c1b6a
  218527: 7fc77a1
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Oct 28, 2010
1 parent 68548a0 commit 9a5acaf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1489ebad8b5b20300562f634f279cb9c435fd90b
refs/heads/master: 26174efd42100eefac67732c0c12f41a205fa335
25 changes: 18 additions & 7 deletions trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,8 @@ bool mem_cgroup_handle_oom(struct mem_cgroup *mem, gfp_t mask)
* small, we check MEM_CGROUP_ON_MOVE percpu value and detect there are
* possibility of race condition. If there is, we take a lock.
*/
void mem_cgroup_update_file_mapped(struct page *page, int val)

static void mem_cgroup_update_file_stat(struct page *page, int idx, int val)
{
struct mem_cgroup *mem;
struct page_cgroup *pc = lookup_page_cgroup(page);
Expand All @@ -1613,13 +1614,18 @@ void mem_cgroup_update_file_mapped(struct page *page, int val)
if (!mem || !PageCgroupUsed(pc))
goto out;
}
if (val > 0) {
this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
SetPageCgroupFileMapped(pc);
} else {
this_cpu_dec(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
if (!page_mapped(page)) /* for race between dec->inc counter */

this_cpu_add(mem->stat->count[idx], val);

switch (idx) {
case MEM_CGROUP_STAT_FILE_MAPPED:
if (val > 0)
SetPageCgroupFileMapped(pc);
else if (!page_mapped(page))
ClearPageCgroupFileMapped(pc);
break;
default:
BUG();
}

out:
Expand All @@ -1629,6 +1635,11 @@ void mem_cgroup_update_file_mapped(struct page *page, int val)
return;
}

void mem_cgroup_update_file_mapped(struct page *page, int val)
{
mem_cgroup_update_file_stat(page, MEM_CGROUP_STAT_FILE_MAPPED, val);
}

/*
* size of first charge trial. "32" comes from vmscan.c's magic value.
* TODO: maybe necessary to use big numbers in big irons.
Expand Down

0 comments on commit 9a5acaf

Please sign in to comment.