mm: retry more before OOM in the presence of slow shrinkers

Shrinkers like lowmemorykiller makes the decision of killing tasks
based on cached levels and also whether previous killed tasks have
been reaped. This can delay the reclaim and by this time no progress
loops of should_reclaim_retry can reach max retries, thus resulting in
premature kills. How fast the no progress loops can complete depends on
cpu speed, thus retry until reclaimable pages are too less (when
__zone_watermark_ok of shouuld_reclaim_retry fails) in the case of slow
shrinkers. This fixes premature order 0 OOMs.
Now, for (0 < order < costly order) cases, should_reclaim_retry can bail
out fast. The decision to try should_compact_retry is based on progress
made in the previous reclaim. A single no progress reclaim can result in
OOMs for higher orders. Fix that too.

Change-Id: I189311e25fc663a2e27d4dc4a38b24024c4cd2a3
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
1 file changed