aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/memcontrol.h10
-rw-r--r--include/linux/sched.h13
-rw-r--r--mm/memcontrol.c16
3 files changed, 19 insertions, 20 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 3e3318ddfc0e..56174c7199ee 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -406,19 +406,19 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
406 406
407static inline void mem_cgroup_oom_enable(void) 407static inline void mem_cgroup_oom_enable(void)
408{ 408{
409 WARN_ON(current->memcg_oom.may_oom); 409 WARN_ON(current->memcg_may_oom);
410 current->memcg_oom.may_oom = 1; 410 current->memcg_may_oom = 1;
411} 411}
412 412
413static inline void mem_cgroup_oom_disable(void) 413static inline void mem_cgroup_oom_disable(void)
414{ 414{
415 WARN_ON(!current->memcg_oom.may_oom); 415 WARN_ON(!current->memcg_may_oom);
416 current->memcg_oom.may_oom = 0; 416 current->memcg_may_oom = 0;
417} 417}
418 418
419static inline bool task_in_memcg_oom(struct task_struct *p) 419static inline bool task_in_memcg_oom(struct task_struct *p)
420{ 420{
421 return p->memcg_oom.memcg; 421 return p->memcg_in_oom;
422} 422}
423 423
424bool mem_cgroup_oom_synchronize(bool wait); 424bool mem_cgroup_oom_synchronize(bool wait);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5423b9c82fee..17bf8b845aa0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1473,7 +1473,9 @@ struct task_struct {
1473 unsigned sched_reset_on_fork:1; 1473 unsigned sched_reset_on_fork:1;
1474 unsigned sched_contributes_to_load:1; 1474 unsigned sched_contributes_to_load:1;
1475 unsigned sched_migrated:1; 1475 unsigned sched_migrated:1;
1476 1476#ifdef CONFIG_MEMCG
1477 unsigned memcg_may_oom:1;
1478#endif
1477#ifdef CONFIG_MEMCG_KMEM 1479#ifdef CONFIG_MEMCG_KMEM
1478 unsigned memcg_kmem_skip_account:1; 1480 unsigned memcg_kmem_skip_account:1;
1479#endif 1481#endif
@@ -1804,12 +1806,9 @@ struct task_struct {
1804 unsigned long trace_recursion; 1806 unsigned long trace_recursion;
1805#endif /* CONFIG_TRACING */ 1807#endif /* CONFIG_TRACING */
1806#ifdef CONFIG_MEMCG 1808#ifdef CONFIG_MEMCG
1807 struct memcg_oom_info { 1809 struct mem_cgroup *memcg_in_oom;
1808 struct mem_cgroup *memcg; 1810 gfp_t memcg_oom_gfp_mask;
1809 gfp_t gfp_mask; 1811 int memcg_oom_order;
1810 int order;
1811 unsigned int may_oom:1;
1812 } memcg_oom;
1813#endif 1812#endif
1814#ifdef CONFIG_UPROBES 1813#ifdef CONFIG_UPROBES
1815 struct uprobe_task *utask; 1814 struct uprobe_task *utask;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c57c4423c688..47bd7f13f526 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1661,7 +1661,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg)
1661 1661
1662static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order) 1662static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
1663{ 1663{
1664 if (!current->memcg_oom.may_oom) 1664 if (!current->memcg_may_oom)
1665 return; 1665 return;
1666 /* 1666 /*
1667 * We are in the middle of the charge context here, so we 1667 * We are in the middle of the charge context here, so we
@@ -1678,9 +1678,9 @@ static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
1678 * and when we know whether the fault was overall successful. 1678 * and when we know whether the fault was overall successful.
1679 */ 1679 */
1680 css_get(&memcg->css); 1680 css_get(&memcg->css);
1681 current->memcg_oom.memcg = memcg; 1681 current->memcg_in_oom = memcg;
1682 current->memcg_oom.gfp_mask = mask; 1682 current->memcg_oom_gfp_mask = mask;
1683 current->memcg_oom.order = order; 1683 current->memcg_oom_order = order;
1684} 1684}
1685 1685
1686/** 1686/**
@@ -1702,7 +1702,7 @@ static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
1702 */ 1702 */
1703bool mem_cgroup_oom_synchronize(bool handle) 1703bool mem_cgroup_oom_synchronize(bool handle)
1704{ 1704{
1705 struct mem_cgroup *memcg = current->memcg_oom.memcg; 1705 struct mem_cgroup *memcg = current->memcg_in_oom;
1706 struct oom_wait_info owait; 1706 struct oom_wait_info owait;
1707 bool locked; 1707 bool locked;
1708 1708
@@ -1730,8 +1730,8 @@ bool mem_cgroup_oom_synchronize(bool handle)
1730 if (locked && !memcg->oom_kill_disable) { 1730 if (locked && !memcg->oom_kill_disable) {
1731 mem_cgroup_unmark_under_oom(memcg); 1731 mem_cgroup_unmark_under_oom(memcg);
1732 finish_wait(&memcg_oom_waitq, &owait.wait); 1732 finish_wait(&memcg_oom_waitq, &owait.wait);
1733 mem_cgroup_out_of_memory(memcg, current->memcg_oom.gfp_mask, 1733 mem_cgroup_out_of_memory(memcg, current->memcg_oom_gfp_mask,
1734 current->memcg_oom.order); 1734 current->memcg_oom_order);
1735 } else { 1735 } else {
1736 schedule(); 1736 schedule();
1737 mem_cgroup_unmark_under_oom(memcg); 1737 mem_cgroup_unmark_under_oom(memcg);
@@ -1748,7 +1748,7 @@ bool mem_cgroup_oom_synchronize(bool handle)
1748 memcg_oom_recover(memcg); 1748 memcg_oom_recover(memcg);
1749 } 1749 }
1750cleanup: 1750cleanup:
1751 current->memcg_oom.memcg = NULL; 1751 current->memcg_in_oom = NULL;
1752 css_put(&memcg->css); 1752 css_put(&memcg->css);
1753 return true; 1753 return true;
1754} 1754}