On Wed, 10 Oct 2012, Michal Hocko wrote: > Hi, > I am sending the patch below as an RFC because I am not entirely happy > about myself and maybe somebody can come up with a different approach > which would be less hackish. I don't see this as hackish, if memory.swappiness limits access to swap then this shouldn't be factored into the calculation, and that's what your patch fixes. The reason why the process with the largest rss isn't killed in this case is because all processes have CAP_SYS_ADMIN so they get a 3% bonus; when factoring swap into the calculation and subtracting 3% from the score in oom_badness(), they all end up having an internal score of 1 so they are all considered equal. It appears like the cgroup_iter_next() iteration for memcg ooms does this in reverse order, which is actually helpful so it will select the task that is newer. The only suggestion I have to make is specify this is for memory.swappiness in the patch title, otherwise: Acked-by: David Rientjes <rientjes@xxxxxxxxxx> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>