Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189577
b: refs/heads/master
c: 8725d54
h: refs/heads/master
i:
  189575: db39ae4
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Apr 7, 2010
1 parent bd45d9a commit 37a6ded
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 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: 116354d177ba2da37e91cf884e3d11e67f825efd
refs/heads/master: 8725d5416213a145ccc9c236dbd26830ba409e00
6 changes: 6 additions & 0 deletions trunk/include/linux/page_cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum {
PCG_CACHE, /* charged as cache */
PCG_USED, /* this object is in use. */
PCG_ACCT_LRU, /* page has been accounted for */
PCG_FILE_MAPPED, /* page is accounted as "mapped" */
};

#define TESTPCGFLAG(uname, lname) \
Expand Down Expand Up @@ -73,6 +74,11 @@ CLEARPCGFLAG(AcctLRU, ACCT_LRU)
TESTPCGFLAG(AcctLRU, ACCT_LRU)
TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)


SETPCGFLAG(FileMapped, FILE_MAPPED)
CLEARPCGFLAG(FileMapped, FILE_MAPPED)
TESTPCGFLAG(FileMapped, FILE_MAPPED)

static inline int page_cgroup_nid(struct page_cgroup *pc)
{
return page_to_nid(pc->page);
Expand Down
18 changes: 9 additions & 9 deletions trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,16 +1359,19 @@ void mem_cgroup_update_file_mapped(struct page *page, int val)

lock_page_cgroup(pc);
mem = pc->mem_cgroup;
if (!mem)
goto done;

if (!PageCgroupUsed(pc))
if (!mem || !PageCgroupUsed(pc))
goto done;

/*
* Preemption is already disabled. We can use __this_cpu_xxx
*/
__this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED], val);
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]);
ClearPageCgroupFileMapped(pc);
}

done:
unlock_page_cgroup(pc);
Expand Down Expand Up @@ -1801,16 +1804,13 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
static void __mem_cgroup_move_account(struct page_cgroup *pc,
struct mem_cgroup *from, struct mem_cgroup *to, bool uncharge)
{
struct page *page;

VM_BUG_ON(from == to);
VM_BUG_ON(PageLRU(pc->page));
VM_BUG_ON(!PageCgroupLocked(pc));
VM_BUG_ON(!PageCgroupUsed(pc));
VM_BUG_ON(pc->mem_cgroup != from);

page = pc->page;
if (page_mapped(page) && !PageAnon(page)) {
if (PageCgroupFileMapped(pc)) {
/* Update mapped_file data for mem_cgroup */
preempt_disable();
__this_cpu_dec(from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
Expand Down

0 comments on commit 37a6ded

Please sign in to comment.