mm: vmscan: check if reclaim should really abort even if compaction_ready() is true for one zone
mm: vmscan: check if reclaim should really abort even if compaction_ready() is true for one zone

If compaction can proceed for a given zone, shrink_zones() does not
reclaim any more pages from it.  After commit [e0c2327: vmscan: abort
reclaim/compaction if compaction can proceed], do_try_to_free_pages()
tries to finish as soon as possible once one zone can compact.

This was intended to prevent slabs being shrunk unnecessarily but there
are side-effects.  One is that a small zone that is ready for compaction
will abort reclaim even if the chances of successfully allocating a THP
from that zone is small.  It also means that reclaim can return too early
even though sc->nr_to_reclaim pages were not reclaimed.

This partially reverts the commit until it is proven that slabs are really
being shrunk unnecessarily but preserves the check to return 1 to avoid
OOM if reclaim was aborted prematurely.

[6cb163d975a8c4c46420677e0054b55c39bdb339@redhat.com: This patch replaces a revert from Andrea]
Signed-off-by: Mel Gorman <39ea6a09710987173e32e37c86918024a0f441c1@suse.de>
Reviewed-by: Rik van Riel <a21938f5d463ddf41aa718934c205ca2cce8ebbc@redhat.com>
Cc: Andrea Arcangeli <6cb163d975a8c4c46420677e0054b55c39bdb339@redhat.com>
Cc: Minchan Kim <12330474acf818c36105a159b1ab0efedce0665c@gmail.com>
Cc: Dave Jones <d5ec0d24602845f6f4b6a35ef729998d1fba5507@redhat.com>
Cc: Jan Kara <596727c8a0ea4db3ba2ceceedccbacd3d7b371b8@suse.cz>
Cc: Andy Isaacson <b3e8ff7ac1c7e75661e16152a5dce1ff36a3e140@hexapodia.org>
Cc: Nai Xia <11a235ce951c4d39e983dc5c87ce279f88ae4e1d@gmail.com>
Cc: Johannes Weiner <5332d5d6802f0c4180a1f65eb38cf05f0ccdfd97@redhat.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs