linux-sg2042/Documentation/cgroups
Michal Hocko 9a5a8f19b4 memcg: oom: fix totalpages calculation for memory.swappiness==0
oom_badness() takes a totalpages argument which says how many pages are
available and it uses it as a base for the score calculation.  The value
is calculated by mem_cgroup_get_limit which considers both limit and
total_swap_pages (resp.  memsw portion of it).

This is usually correct but since fe35004fbf ("mm: avoid swapping out
with swappiness==0") we do not swap when swappiness is 0 which means
that we cannot really use up all the totalpages pages.  This in turn
confuses oom score calculation if the memcg limit is much smaller than
the available swap because the used memory (capped by the limit) is
negligible comparing to totalpages so the resulting score is too small
if adj!=0 (typically task with CAP_SYS_ADMIN or non zero oom_score_adj).
A wrong process might be selected as result.

The problem can be worked around by checking mem_cgroup_swappiness==0
and not considering swap at all in such a case.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-11-16 14:33:04 -08:00
..
00-INDEX trivial: fix where cgroup documentation is not correctly referred to 2009-03-30 15:22:02 +02:00
blkio-controller.txt Documentation: Fix multiple typo in Documentation 2012-03-07 16:08:24 +01:00
cgroup_event_listener.c tree-wide: fix comment/printk typos 2010-11-01 15:38:34 -04:00
cgroups.txt cgroup: trivial fixes for Documentation/cgroups/cgroups.txt 2012-09-13 11:10:54 -07:00
cpuacct.txt Documentation: fix echo command in cgroups/cpuacct.txt 2011-07-23 10:58:08 -07:00
cpusets.txt documentation: remove references to cpu_*_map. 2012-03-29 15:38:31 +10:30
devices.txt Documentation: update cgroupfs mount point 2011-06-15 21:52:50 -07:00
freezer-subsystem.txt Documentation: Fix typo in freezer-subsystem.txt 2011-11-07 23:02:25 +01:00
hugetlb.txt hugetlb/cgroup: add HugeTLB controller documentation 2012-07-31 18:42:41 -07:00
memcg_test.txt tree-wide: fix comment/printk typos 2010-11-01 15:38:34 -04:00
memory.txt memcg: oom: fix totalpages calculation for memory.swappiness==0 2012-11-16 14:33:04 -08:00
net_prio.txt net: add documentation for net_prio cgroups (v4) 2011-11-22 15:22:23 -05:00
resource_counter.txt rescounters: add res_counter_uncharge_until() 2012-05-29 16:22:27 -07:00