diff options
Diffstat (limited to 'mm/memcontrol.c')
| -rw-r--r-- | mm/memcontrol.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9b648bd63451..2e0bfc93484b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -533,6 +533,9 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, | |||
| 533 | unsigned long nr_retries = MEM_CGROUP_RECLAIM_RETRIES; | 533 | unsigned long nr_retries = MEM_CGROUP_RECLAIM_RETRIES; |
| 534 | struct mem_cgroup_per_zone *mz; | 534 | struct mem_cgroup_per_zone *mz; |
| 535 | 535 | ||
| 536 | if (mem_cgroup_subsys.disabled) | ||
| 537 | return 0; | ||
| 538 | |||
| 536 | /* | 539 | /* |
| 537 | * Should page_cgroup's go to their own slab? | 540 | * Should page_cgroup's go to their own slab? |
| 538 | * One could optimize the performance of the charging routine | 541 | * One could optimize the performance of the charging routine |
| @@ -665,6 +668,9 @@ void mem_cgroup_uncharge_page(struct page *page) | |||
| 665 | struct mem_cgroup_per_zone *mz; | 668 | struct mem_cgroup_per_zone *mz; |
| 666 | unsigned long flags; | 669 | unsigned long flags; |
| 667 | 670 | ||
| 671 | if (mem_cgroup_subsys.disabled) | ||
| 672 | return; | ||
| 673 | |||
| 668 | /* | 674 | /* |
| 669 | * Check if our page_cgroup is valid | 675 | * Check if our page_cgroup is valid |
| 670 | */ | 676 | */ |
| @@ -705,6 +711,9 @@ int mem_cgroup_prepare_migration(struct page *page) | |||
| 705 | { | 711 | { |
| 706 | struct page_cgroup *pc; | 712 | struct page_cgroup *pc; |
| 707 | 713 | ||
| 714 | if (mem_cgroup_subsys.disabled) | ||
| 715 | return 0; | ||
| 716 | |||
| 708 | lock_page_cgroup(page); | 717 | lock_page_cgroup(page); |
| 709 | pc = page_get_page_cgroup(page); | 718 | pc = page_get_page_cgroup(page); |
| 710 | if (pc) | 719 | if (pc) |
| @@ -803,6 +812,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup *mem) | |||
| 803 | int ret = -EBUSY; | 812 | int ret = -EBUSY; |
| 804 | int node, zid; | 813 | int node, zid; |
| 805 | 814 | ||
| 815 | if (mem_cgroup_subsys.disabled) | ||
| 816 | return 0; | ||
| 817 | |||
| 806 | css_get(&mem->css); | 818 | css_get(&mem->css); |
| 807 | /* | 819 | /* |
| 808 | * page reclaim code (kswapd etc..) will move pages between | 820 | * page reclaim code (kswapd etc..) will move pages between |
| @@ -966,7 +978,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node) | |||
| 966 | { | 978 | { |
| 967 | struct mem_cgroup_per_node *pn; | 979 | struct mem_cgroup_per_node *pn; |
| 968 | struct mem_cgroup_per_zone *mz; | 980 | struct mem_cgroup_per_zone *mz; |
| 969 | int zone; | 981 | int zone, tmp = node; |
| 970 | /* | 982 | /* |
| 971 | * This routine is called against possible nodes. | 983 | * This routine is called against possible nodes. |
| 972 | * But it's BUG to call kmalloc() against offline node. | 984 | * But it's BUG to call kmalloc() against offline node. |
| @@ -975,10 +987,9 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node) | |||
| 975 | * never be onlined. It's better to use memory hotplug callback | 987 | * never be onlined. It's better to use memory hotplug callback |
| 976 | * function. | 988 | * function. |
| 977 | */ | 989 | */ |
| 978 | if (node_state(node, N_HIGH_MEMORY)) | 990 | if (!node_state(node, N_NORMAL_MEMORY)) |
| 979 | pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node); | 991 | tmp = -1; |
| 980 | else | 992 | pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, tmp); |
| 981 | pn = kmalloc(sizeof(*pn), GFP_KERNEL); | ||
| 982 | if (!pn) | 993 | if (!pn) |
| 983 | return 1; | 994 | return 1; |
| 984 | 995 | ||
| @@ -1053,6 +1064,8 @@ static void mem_cgroup_destroy(struct cgroup_subsys *ss, | |||
| 1053 | static int mem_cgroup_populate(struct cgroup_subsys *ss, | 1064 | static int mem_cgroup_populate(struct cgroup_subsys *ss, |
| 1054 | struct cgroup *cont) | 1065 | struct cgroup *cont) |
| 1055 | { | 1066 | { |
| 1067 | if (mem_cgroup_subsys.disabled) | ||
| 1068 | return 0; | ||
| 1056 | return cgroup_add_files(cont, ss, mem_cgroup_files, | 1069 | return cgroup_add_files(cont, ss, mem_cgroup_files, |
| 1057 | ARRAY_SIZE(mem_cgroup_files)); | 1070 | ARRAY_SIZE(mem_cgroup_files)); |
| 1058 | } | 1071 | } |
| @@ -1065,6 +1078,9 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, | |||
| 1065 | struct mm_struct *mm; | 1078 | struct mm_struct *mm; |
| 1066 | struct mem_cgroup *mem, *old_mem; | 1079 | struct mem_cgroup *mem, *old_mem; |
| 1067 | 1080 | ||
| 1081 | if (mem_cgroup_subsys.disabled) | ||
| 1082 | return; | ||
| 1083 | |||
| 1068 | mm = get_task_mm(p); | 1084 | mm = get_task_mm(p); |
| 1069 | if (mm == NULL) | 1085 | if (mm == NULL) |
| 1070 | return; | 1086 | return; |
