path: root/mm/filemap.c
diff options
authorBalbir Singh <>2008-02-07 00:14:02 -0800
committerLinus Torvalds <>2008-02-07 08:42:19 -0800
commite1a1cd590e3fcb0d2e230128daf2337ea55387dc (patch)
treeeb660ab340c657a1eb595b2d4d8e8b62783bf6fb /mm/filemap.c
parentbed7161a519a2faef53e1bce1b47595e297c1d14 (diff)
Memory controller: make charging gfp mask aware
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. [ problem with ZONE_MOVABLE] Signed-off-by: Balbir Singh <> Cc: Pavel Emelianov <> Cc: Paul Menage <> Cc: Peter Zijlstra <> Cc: "Eric W. Biederman" <> Cc: Nick Piggin <> Cc: Kirill Korotaev <> Cc: Herbert Poetzl <> Cc: David Rientjes <> Cc: Vaidyanathan Srinivasan <> Signed-off-by: KAMEZAWA Hiroyuki <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/filemap.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 8ae171cc281..63040d5e0ae 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -464,7 +464,7 @@ int add_to_page_cache(struct page *page, struct address_space *mapping,
if (error == 0) {
- error = mem_cgroup_cache_charge(page, current->mm);
+ error = mem_cgroup_cache_charge(page, current->mm, gfp_mask);
if (error)
goto out;