diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 15:36:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 15:36:49 -0500 |
commit | d4220f987cf473c65a342ca69e3eb13dea919a49 (patch) | |
tree | dbb004a9c805d6de3f6e3955398fee1084a29f16 /mm/memcontrol.c | |
parent | 61cf693159d6a968a7014e24905143f71ed8ddcf (diff) | |
parent | f2c03debdfb387fa2e35cac6382779072b8b9209 (diff) |
Merge branch 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6
* 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6: (34 commits)
HWPOISON: Remove stray phrase in a comment
HWPOISON: Try to allocate migration page on the same node
HWPOISON: Don't do early filtering if filter is disabled
HWPOISON: Add a madvise() injector for soft page offlining
HWPOISON: Add soft page offline support
HWPOISON: Undefine short-hand macros after use to avoid namespace conflict
HWPOISON: Use new shake_page in memory_failure
HWPOISON: Use correct name for MADV_HWPOISON in documentation
HWPOISON: mention HWPoison in Kconfig entry
HWPOISON: Use get_user_page_fast in hwpoison madvise
HWPOISON: add an interface to switch off/on all the page filters
HWPOISON: add memory cgroup filter
memcg: add accessor to mem_cgroup.css
memcg: rename and export try_get_mem_cgroup_from_page()
HWPOISON: add page flags filter
mm: export stable page flags
HWPOISON: limit hwpoison injector to known page types
HWPOISON: add fs/device filters
HWPOISON: return 0 to indicate success reliably
HWPOISON: make semantics of IGNORED/DELAYED clear
...
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 878808c4fcbe..488b644e0e8e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -283,6 +283,11 @@ mem_cgroup_zoneinfo(struct mem_cgroup *mem, int nid, int zid) | |||
283 | return &mem->info.nodeinfo[nid]->zoneinfo[zid]; | 283 | return &mem->info.nodeinfo[nid]->zoneinfo[zid]; |
284 | } | 284 | } |
285 | 285 | ||
286 | struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem) | ||
287 | { | ||
288 | return &mem->css; | ||
289 | } | ||
290 | |||
286 | static struct mem_cgroup_per_zone * | 291 | static struct mem_cgroup_per_zone * |
287 | page_cgroup_zoneinfo(struct page_cgroup *pc) | 292 | page_cgroup_zoneinfo(struct page_cgroup *pc) |
288 | { | 293 | { |
@@ -1536,25 +1541,22 @@ static struct mem_cgroup *mem_cgroup_lookup(unsigned short id) | |||
1536 | return container_of(css, struct mem_cgroup, css); | 1541 | return container_of(css, struct mem_cgroup, css); |
1537 | } | 1542 | } |
1538 | 1543 | ||
1539 | static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page) | 1544 | struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) |
1540 | { | 1545 | { |
1541 | struct mem_cgroup *mem; | 1546 | struct mem_cgroup *mem = NULL; |
1542 | struct page_cgroup *pc; | 1547 | struct page_cgroup *pc; |
1543 | unsigned short id; | 1548 | unsigned short id; |
1544 | swp_entry_t ent; | 1549 | swp_entry_t ent; |
1545 | 1550 | ||
1546 | VM_BUG_ON(!PageLocked(page)); | 1551 | VM_BUG_ON(!PageLocked(page)); |
1547 | 1552 | ||
1548 | if (!PageSwapCache(page)) | ||
1549 | return NULL; | ||
1550 | |||
1551 | pc = lookup_page_cgroup(page); | 1553 | pc = lookup_page_cgroup(page); |
1552 | lock_page_cgroup(pc); | 1554 | lock_page_cgroup(pc); |
1553 | if (PageCgroupUsed(pc)) { | 1555 | if (PageCgroupUsed(pc)) { |
1554 | mem = pc->mem_cgroup; | 1556 | mem = pc->mem_cgroup; |
1555 | if (mem && !css_tryget(&mem->css)) | 1557 | if (mem && !css_tryget(&mem->css)) |
1556 | mem = NULL; | 1558 | mem = NULL; |
1557 | } else { | 1559 | } else if (PageSwapCache(page)) { |
1558 | ent.val = page_private(page); | 1560 | ent.val = page_private(page); |
1559 | id = lookup_swap_cgroup(ent); | 1561 | id = lookup_swap_cgroup(ent); |
1560 | rcu_read_lock(); | 1562 | rcu_read_lock(); |
@@ -1874,7 +1876,7 @@ int mem_cgroup_try_charge_swapin(struct mm_struct *mm, | |||
1874 | */ | 1876 | */ |
1875 | if (!PageSwapCache(page)) | 1877 | if (!PageSwapCache(page)) |
1876 | goto charge_cur_mm; | 1878 | goto charge_cur_mm; |
1877 | mem = try_get_mem_cgroup_from_swapcache(page); | 1879 | mem = try_get_mem_cgroup_from_page(page); |
1878 | if (!mem) | 1880 | if (!mem) |
1879 | goto charge_cur_mm; | 1881 | goto charge_cur_mm; |
1880 | *ptr = mem; | 1882 | *ptr = mem; |