diff options
-rw-r--r-- | include/linux/memcontrol.h | 3 | ||||
-rw-r--r-- | mm/memcontrol.c | 6 | ||||
-rw-r--r-- | mm/oom_kill.c | 7 |
3 files changed, 9 insertions, 7 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index b80de520670b..d90965086fae 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -77,7 +77,8 @@ extern void mem_cgroup_uncharge_end(void); | |||
77 | extern void mem_cgroup_uncharge_page(struct page *page); | 77 | extern void mem_cgroup_uncharge_page(struct page *page); |
78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
79 | 79 | ||
80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask); | 80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, |
81 | int order); | ||
81 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); | 82 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); |
82 | 83 | ||
83 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); | 84 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 37281816ff67..bb04067269bc 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1811,7 +1811,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg) | |||
1811 | /* | 1811 | /* |
1812 | * try to call OOM killer. returns false if we should exit memory-reclaim loop. | 1812 | * try to call OOM killer. returns false if we should exit memory-reclaim loop. |
1813 | */ | 1813 | */ |
1814 | bool mem_cgroup_handle_oom(struct mem_cgroup *memcg, gfp_t mask) | 1814 | bool mem_cgroup_handle_oom(struct mem_cgroup *memcg, gfp_t mask, int order) |
1815 | { | 1815 | { |
1816 | struct oom_wait_info owait; | 1816 | struct oom_wait_info owait; |
1817 | bool locked, need_to_kill; | 1817 | bool locked, need_to_kill; |
@@ -1841,7 +1841,7 @@ bool mem_cgroup_handle_oom(struct mem_cgroup *memcg, gfp_t mask) | |||
1841 | 1841 | ||
1842 | if (need_to_kill) { | 1842 | if (need_to_kill) { |
1843 | finish_wait(&memcg_oom_waitq, &owait.wait); | 1843 | finish_wait(&memcg_oom_waitq, &owait.wait); |
1844 | mem_cgroup_out_of_memory(memcg, mask); | 1844 | mem_cgroup_out_of_memory(memcg, mask, order); |
1845 | } else { | 1845 | } else { |
1846 | schedule(); | 1846 | schedule(); |
1847 | finish_wait(&memcg_oom_waitq, &owait.wait); | 1847 | finish_wait(&memcg_oom_waitq, &owait.wait); |
@@ -2212,7 +2212,7 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, | |||
2212 | if (!oom_check) | 2212 | if (!oom_check) |
2213 | return CHARGE_NOMEM; | 2213 | return CHARGE_NOMEM; |
2214 | /* check OOM */ | 2214 | /* check OOM */ |
2215 | if (!mem_cgroup_handle_oom(mem_over_limit, gfp_mask)) | 2215 | if (!mem_cgroup_handle_oom(mem_over_limit, gfp_mask, get_order(csize))) |
2216 | return CHARGE_OOM_DIE; | 2216 | return CHARGE_OOM_DIE; |
2217 | 2217 | ||
2218 | return CHARGE_RETRY; | 2218 | return CHARGE_RETRY; |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index f23f33454645..4198e000f41a 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -554,7 +554,8 @@ static void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, | |||
554 | } | 554 | } |
555 | 555 | ||
556 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 556 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
557 | void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask) | 557 | void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, |
558 | int order) | ||
558 | { | 559 | { |
559 | unsigned long limit; | 560 | unsigned long limit; |
560 | unsigned int points = 0; | 561 | unsigned int points = 0; |
@@ -570,12 +571,12 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask) | |||
570 | return; | 571 | return; |
571 | } | 572 | } |
572 | 573 | ||
573 | check_panic_on_oom(CONSTRAINT_MEMCG, gfp_mask, 0, NULL); | 574 | check_panic_on_oom(CONSTRAINT_MEMCG, gfp_mask, order, NULL); |
574 | limit = mem_cgroup_get_limit(memcg) >> PAGE_SHIFT; | 575 | limit = mem_cgroup_get_limit(memcg) >> PAGE_SHIFT; |
575 | read_lock(&tasklist_lock); | 576 | read_lock(&tasklist_lock); |
576 | p = select_bad_process(&points, limit, memcg, NULL, false); | 577 | p = select_bad_process(&points, limit, memcg, NULL, false); |
577 | if (p && PTR_ERR(p) != -1UL) | 578 | if (p && PTR_ERR(p) != -1UL) |
578 | oom_kill_process(p, gfp_mask, 0, points, limit, memcg, NULL, | 579 | oom_kill_process(p, gfp_mask, order, points, limit, memcg, NULL, |
579 | "Memory cgroup out of memory"); | 580 | "Memory cgroup out of memory"); |
580 | read_unlock(&tasklist_lock); | 581 | read_unlock(&tasklist_lock); |
581 | } | 582 | } |