Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1949632AbdDYPZS (ORCPT ); Tue, 25 Apr 2017 11:25:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54908 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1948995AbdDYPLa (ORCPT ); Tue, 25 Apr 2017 11:11:30 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rabin Vincent , Michal Hocko , Ming Ling , Minchan Kim , Vlastimil Babka , Andrew Morton , Linus Torvalds Subject: [PATCH 4.9 06/21] mm: prevent NR_ISOLATE_* stats from going negative Date: Tue, 25 Apr 2017 16:09:01 +0100 Message-Id: <20170425150827.670291137@linuxfoundation.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170425150827.381333941@linuxfoundation.org> References: <20170425150827.381333941@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2083 Lines: 58 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rabin Vincent commit fc280fe871449ead4bdbd1665fa52c7c01c64765 upstream. Commit 6afcf8ef0ca0 ("mm, compaction: fix NR_ISOLATED_* stats for pfn based migration") moved the dec_node_page_state() call (along with the page_is_file_cache() call) to after putback_lru_page(). But page_is_file_cache() can change after putback_lru_page() is called, so it should be called before putback_lru_page(), as it was before that patch, to prevent NR_ISOLATE_* stats from going negative. Without this fix, non-CONFIG_SMP kernels end up hanging in the while(too_many_isolated()) { congestion_wait() } loop in shrink_active_list() due to the negative stats. Mem-Info: active_anon:32567 inactive_anon:121 isolated_anon:1 active_file:6066 inactive_file:6639 isolated_file:4294967295 ^^^^^^^^^^ unevictable:0 dirty:115 writeback:0 unstable:0 slab_reclaimable:2086 slab_unreclaimable:3167 mapped:3398 shmem:18366 pagetables:1145 bounce:0 free:1798 free_pcp:13 free_cma:0 Fixes: 6afcf8ef0ca0 ("mm, compaction: fix NR_ISOLATED_* stats for pfn based migration") Link: http://lkml.kernel.org/r/1492683865-27549-1-git-send-email-rabin.vincent@axis.com Signed-off-by: Rabin Vincent Acked-by: Michal Hocko Cc: Ming Ling Cc: Minchan Kim Cc: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/migrate.c +++ b/mm/migrate.c @@ -183,9 +183,9 @@ void putback_movable_pages(struct list_h unlock_page(page); put_page(page); } else { - putback_lru_page(page); dec_node_page_state(page, NR_ISOLATED_ANON + page_is_file_cache(page)); + putback_lru_page(page); } } }