mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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. [kamezawa.hiroyu@jp.fujitsu.com: problem with ZONE_MOVABLE] Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Pavel Emelianov <xemul@openvz.org> Cc: Paul Menage <menage@google.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Kirill Korotaev <dev@sw.ru> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: David Rientjes <rientjes@google.com> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bed7161a51
commit
e1a1cd590e
9 changed files with 41 additions and 30 deletions
|
@ -32,7 +32,8 @@ extern void mm_free_cgroup(struct mm_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_isolate_pages(unsigned long nr_to_scan,
|
|||
struct mem_cgroup *mem_cont,
|
||||
int active);
|
||||
extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
|
||||
extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm);
|
||||
extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
|
||||
gfp_t gfp_mask);
|
||||
extern struct mem_cgroup *mm_cgroup(struct mm_struct *mm);
|
||||
|
||||
static inline void mem_cgroup_uncharge_page(struct page *page)
|
||||
|
@ -70,7 +72,8 @@ static inline struct page_cgroup *page_get_page_cgroup(struct page *page)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline int mem_cgroup_charge(struct page *page, struct mm_struct *mm)
|
||||
static inline int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -89,7 +92,8 @@ static inline void mem_cgroup_move_lists(struct page_cgroup *pc,
|
|||
}
|
||||
|
||||
static inline int mem_cgroup_cache_charge(struct page *page,
|
||||
struct mm_struct *mm)
|
||||
struct mm_struct *mm,
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue