OpenVZ Forum - RDF feed
type: channel
items: [PATCH 33/33] memory-controller-make-charging-gfp-mask-aware

[PATCH 33/33] memory-controller-make-charging-gfp-mask-aware
type: item
description: From: Balbir Singh <balbir@linux.vnet.ibm.com> (container->cgroup renaming by Paul Menage <menage@google.com>) Nick Piggin pointed out that swap cache and page cache addition routines could be called from non GFP_KERNEL contexts. This patch makes the charging routine aware of the gfp context. Charging might fail if the cgroup is over it's limit, in which case a suitable error is returned. This patch was tested on a Powerpc box. I am still looking at being able to test the path, through which allocations happen in non GFP_KERNEL contexts. Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Paul Menage <menage@google.com> --- include/linux/memcontrol.h | 12 ++++++++---- include/linux/swap.h | 3 ++- mm/filemap.c | 2 +- mm/memcontrol.c | 24 +++++++++++++++++------- mm/memory.c | 10 +++++----- mm/migrate.c | 2 +- mm/swap_state.c | 2 +- mm/swapfile.c | 2 +- mm/vmscan.c | 5 +++-- 9 files changed, 39 insertions(+), 23 deletions(-) diff -puN include/linux/memcontrol.h~memory-controller-make-charging-gfp-mask-aware include/linux/memcontrol.h --- a/include/linux/memcontrol.h~memory-controller-make-charging-gfp-mask-aware +++ a/include/linux/memcontrol.h @@ -32,7 +32,8 @@ extern void mm_free_cgroup(struct mm_ extern void page_assign_page_cgroup(struct page *page, struct page_cgroup *pc); extern struct page_cgroup *page_get_page_cgroup(struct page *page); -extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm); +extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, + gfp_t gfp_mask); extern void mem_cgroup_uncharge(struct page_cgroup *pc); extern void mem_cgroup_move_lists(struct page_cgroup *pc, bool active); extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, @@ -42,7 +43,8 @@ extern unsigned long mem_cgroup_isola struct mem_cgroup *mem_cont, int active); extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem); -extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm); +extern int mem…
creator: Paul Menage
date: 2007-09-17T21:03:40-00:00