Skip to content

Commit

Permalink
memcontrol: move mm_cgroup to header file
Browse files Browse the repository at this point in the history
Inline functions must preceed their use, so mm_cgroup() should be defined
in linux/memcontrol.h.

include/linux/memcontrol.h:48: warning: 'mm_cgroup' declared inline after
	being called
include/linux/memcontrol.h:48: warning: previous declaration of
	'mm_cgroup' was here

[[email protected]: build fix]
[[email protected]: nuther build fix]
Cc: Balbir Singh <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rientjes authored and Linus Torvalds committed Feb 7, 2008
1 parent e1a1cd5 commit 3062fc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 9 additions & 2 deletions include/linux/memcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#ifndef _LINUX_MEMCONTROL_H
#define _LINUX_MEMCONTROL_H

#include <linux/rcupdate.h>
#include <linux/mm.h>

struct mem_cgroup;
struct page_cgroup;
struct page;
Expand All @@ -45,7 +48,11 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
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,
gfp_t gfp_mask);
extern struct mem_cgroup *mm_cgroup(struct mm_struct *mm);

static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm)
{
return rcu_dereference(mm->mem_cgroup);
}

static inline void mem_cgroup_uncharge_page(struct page *page)
{
Expand Down Expand Up @@ -98,7 +105,7 @@ static inline int mem_cgroup_cache_charge(struct page *page,
return 0;
}

static inline struct mem_cgroup *mm_cgroup(struct mm_struct *mm)
static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm)
{
return NULL;
}
Expand Down
5 changes: 0 additions & 5 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p)
struct mem_cgroup, css);
}

inline struct mem_cgroup *mm_cgroup(struct mm_struct *mm)
{
return rcu_dereference(mm->mem_cgroup);
}

void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p)
{
struct mem_cgroup *mem;
Expand Down

0 comments on commit 3062fc6

Please sign in to comment.