Suleiman Souhlal 4c9c535968 memcg: reclaim when more than one page needed
mem_cgroup_do_charge() was written before kmem accounting, and expects
three cases: being called for 1 page, being called for a stock of 32
pages, or being called for a hugepage.  If we call for 2 or 3 pages (and
both the stack and several slabs used in process creation are such, at
least with the debug options I had), it assumed it's being called for
stock and just retried without reclaiming.

Fix that by passing down a minsize argument in addition to the csize.

And what to do about that (csize == PAGE_SIZE && ret) retry?  If it's
needed at all (and presumably is since it's there, perhaps to handle
races), then it should be extended to more than PAGE_SIZE, yet how far?
And should there be a retry count limit, of what?  For now retry up to
COSTLY_ORDER (as page_alloc.c does) and make sure not to do it if
__GFP_NORETRY.

v4: fixed nr pages calculation pointed out by Christoph Lameter.

Signed-off-by: Suleiman Souhlal <suleiman@google.com>
Signed-off-by: Glauber Costa <glommer@parallels.com>
Acked-by: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Frederic Weisbecker <fweisbec@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: JoonSoo Kim <js1304@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-18 15:02:12 -08:00
..
2012-05-29 23:28:33 -04:00
2012-12-16 15:18:08 -08:00
2012-01-03 22:54:56 -05:00
2012-12-16 15:18:08 -08:00
2012-12-16 15:18:08 -08:00
2012-12-16 15:18:08 -08:00
2012-12-16 15:18:08 -08:00
2012-12-16 15:18:08 -08:00
2012-12-17 17:15:17 -08:00
2012-12-16 15:18:08 -08:00
2012-10-09 16:23:03 +09:00
2012-12-16 15:18:08 -08:00
2012-12-16 15:18:08 -08:00
2012-12-16 15:18:08 -08:00
2012-06-20 14:39:36 -07:00
2012-12-16 15:18:08 -08:00
2012-12-11 12:14:28 +02:00
2012-12-11 12:14:28 +02:00
2012-12-11 12:14:28 +02:00
2012-10-09 16:22:55 +09:00
2012-10-28 19:29:19 +01:00
2012-12-16 15:18:08 -08:00