Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83773
b: refs/heads/master
c: 4c4a221
h: refs/heads/master
i:
  83771: af6f2c3
v: v3
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Feb 7, 2008
1 parent 071a54e commit a80e0d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c6bc8dd5a0932f2c0b30a5f0a124464b7f614d0
refs/heads/master: 4c4a22148909e4c003562ea7ffe0a06e26919e3c
7 changes: 7 additions & 0 deletions trunk/include/linux/memcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ 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);
int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);

static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm)
{
Expand Down Expand Up @@ -110,6 +111,12 @@ static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm)
return NULL;
}

static inline int task_in_mem_cgroup(struct task_struct *task,
const struct mem_cgroup *mem)
{
return 1;
}

#endif /* CONFIG_CGROUP_MEM_CONT */

#endif /* _LINUX_MEMCONTROL_H */
Expand Down
10 changes: 10 additions & 0 deletions trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ static void __mem_cgroup_move_lists(struct page_cgroup *pc, bool active)
list_move(&pc->lru, &pc->mem_cgroup->inactive_list);
}

int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
{
int ret;

task_lock(task);
ret = task->mm && mm_cgroup(task->mm) == mem;
task_unlock(task);
return ret;
}

/*
* This routine assumes that the appropriate zone's lru lock is already held
*/
Expand Down
9 changes: 2 additions & 7 deletions trunk/mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime,
return 0;
}

#ifdef CONFIG_CGROUP_MEM_CONT
if (mem != NULL && mm->mem_cgroup != mem) {
task_unlock(p);
return 0;
}
#endif

/*
* The memory size of the process is the basis for the badness.
*/
Expand Down Expand Up @@ -223,6 +216,8 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
/* skip the init task */
if (is_global_init(p))
continue;
if (mem && !task_in_mem_cgroup(p, mem))
continue;

/*
* This task already has access to memory reserves and is
Expand Down

0 comments on commit a80e0d1

Please sign in to comment.