Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 335788
b: refs/heads/master
c: 9a5a8f1
h: refs/heads/master
v: v3
  • Loading branch information
Michal Hocko authored and Linus Torvalds committed Nov 16, 2012
1 parent 73e941f commit 0970bc7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 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: 1756954c61cb5c97c618ccb366482b9c1f891d6d
refs/heads/master: 9a5a8f19b43430752067ecaee62fc59e11e88fa6
4 changes: 4 additions & 0 deletions trunk/Documentation/cgroups/memory.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ Note:
5.3 swappiness

Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only.
Please note that unlike the global swappiness, memcg knob set to 0
really prevents from any swapping even if there is a swap storage
available. This might lead to memcg OOM killer if there are no file
pages to reclaim.

Following cgroups' swappiness can't be changed.
- root cgroup (uses /proc/sys/vm/swappiness).
Expand Down
21 changes: 15 additions & 6 deletions trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,17 +1452,26 @@ static int mem_cgroup_count_children(struct mem_cgroup *memcg)
static u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
{
u64 limit;
u64 memsw;

limit = res_counter_read_u64(&memcg->res, RES_LIMIT);
limit += total_swap_pages << PAGE_SHIFT;

memsw = res_counter_read_u64(&memcg->memsw, RES_LIMIT);
/*
* If memsw is finite and limits the amount of swap space available
* to this memcg, return that limit.
* Do not consider swap space if we cannot swap due to swappiness
*/
return min(limit, memsw);
if (mem_cgroup_swappiness(memcg)) {
u64 memsw;

limit += total_swap_pages << PAGE_SHIFT;
memsw = res_counter_read_u64(&memcg->memsw, RES_LIMIT);

/*
* If memsw is finite and limits the amount of swap space
* available to this memcg, return that limit.
*/
limit = min(limit, memsw);
}

return limit;
}

void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
Expand Down

0 comments on commit 0970bc7

Please sign in to comment.