OSDN Git Service

mm: vmscan: fix the page state calculation in too_many_isolated
authorVinayak Menon <vinmenon@codeaurora.org>
Fri, 26 Dec 2014 13:59:41 +0000 (19:29 +0530)
committerKyle Yan <kyan@codeaurora.org>
Tue, 31 May 2016 22:23:28 +0000 (15:23 -0700)
commit44bd107fc9cdb2d3b195e01611b074f609b97f1a
treedee71c4f53a91e03a5cc8e847f36899ecab1d0e6
parenteaee620aa28e718a9eabe642b2249764f2d86614
mm: vmscan: fix the page state calculation in too_many_isolated

It is observed that sometimes multiple tasks get blocked in
the congestion_wait loop below, in shrink_inactive_list.

(__schedule) from [<c0a03328>]
(schedule_timeout) from [<c0a04940>]
(io_schedule_timeout) from [<c01d585c>]
(congestion_wait) from [<c01cc9d8>]
(shrink_inactive_list) from [<c01cd034>]
(shrink_zone) from [<c01cdd08>]
(try_to_free_pages) from [<c01c442c>]
(__alloc_pages_nodemask) from [<c01f1884>]
(new_slab) from [<c09fcf60>]
(__slab_alloc) from [<c01f1a6c>]

In one such instance, zone_page_state(zone, NR_ISOLATED_FILE)
had returned 14, zone_page_state(zone, NR_INACTIVE_FILE)
returned 92, and the gfp_flag was GFP_KERNEL which resulted
in too_many_isolated to return true. But one of the CPU pageset
vmstat diff had NR_ISOLATED_FILE as -14. As there weren't any more
update to per cpu pageset, the threshold wasn't met, and the
tasks were blocked in the congestion wait.

This patch uses zone_page_state_snapshot instead, but restricts
its usage to avoid performance penalty.

Change-Id: Iec767a548e524729c7ed79a92fe4718cdd08ce69
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
mm/vmscan.c