diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-23 12:38:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-23 12:38:07 -0400 |
commit | fc3ac5c75bae55ca6a070eb72038a94d4f130d8d (patch) | |
tree | 9ff7417bda4655bafa961bebf600ea6fd0cab8a4 /mm/memcontrol.c | |
parent | 9abd09acd664c68f06242da191209d9c70df6953 (diff) | |
parent | 0d9327ab70038ac8c7af6e20456578ab80158f2d (diff) |
Merge branch 'akpm' (incoming from Andrew)
Merge misc fixes from Andrew Morton:
"9 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
MAINTAINERS: add closing angle bracket to Vince Bridgers' email address
Documentation: fix DOCBOOKS=... building
ocfs2: fix double kmem_cache_destroy in dlm_init
mm/memory-failure.c: fix memory leak by race between poison and unpoison
wait: swap EXIT_ZOMBIE(Z) and EXIT_DEAD(X) chars in TASK_STATE_TO_CHAR_STR
memcg: fix swapcache charge from kernel thread context
mm: madvise: fix MADV_WILLNEED on shmem swapouts
mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT
hwpoison, hugetlb: lock_page/unlock_page does not match for handling a free hugepage
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c47dffdcb246..5177c6d4a2dd 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1077,9 +1077,18 @@ static struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) | |||
1077 | 1077 | ||
1078 | rcu_read_lock(); | 1078 | rcu_read_lock(); |
1079 | do { | 1079 | do { |
1080 | memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); | 1080 | /* |
1081 | if (unlikely(!memcg)) | 1081 | * Page cache insertions can happen withou an |
1082 | * actual mm context, e.g. during disk probing | ||
1083 | * on boot, loopback IO, acct() writes etc. | ||
1084 | */ | ||
1085 | if (unlikely(!mm)) | ||
1082 | memcg = root_mem_cgroup; | 1086 | memcg = root_mem_cgroup; |
1087 | else { | ||
1088 | memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); | ||
1089 | if (unlikely(!memcg)) | ||
1090 | memcg = root_mem_cgroup; | ||
1091 | } | ||
1083 | } while (!css_tryget(&memcg->css)); | 1092 | } while (!css_tryget(&memcg->css)); |
1084 | rcu_read_unlock(); | 1093 | rcu_read_unlock(); |
1085 | return memcg; | 1094 | return memcg; |
@@ -3958,17 +3967,9 @@ int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm, | |||
3958 | return 0; | 3967 | return 0; |
3959 | } | 3968 | } |
3960 | 3969 | ||
3961 | /* | 3970 | memcg = mem_cgroup_try_charge_mm(mm, gfp_mask, 1, true); |
3962 | * Page cache insertions can happen without an actual mm | 3971 | if (!memcg) |
3963 | * context, e.g. during disk probing on boot. | 3972 | return -ENOMEM; |
3964 | */ | ||
3965 | if (unlikely(!mm)) | ||
3966 | memcg = root_mem_cgroup; | ||
3967 | else { | ||
3968 | memcg = mem_cgroup_try_charge_mm(mm, gfp_mask, 1, true); | ||
3969 | if (!memcg) | ||
3970 | return -ENOMEM; | ||
3971 | } | ||
3972 | __mem_cgroup_commit_charge(memcg, page, 1, type, false); | 3973 | __mem_cgroup_commit_charge(memcg, page, 1, type, false); |
3973 | return 0; | 3974 | return 0; |
3974 | } | 3975 | } |