From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932264AbcFEV55 (ORCPT ); Sun, 5 Jun 2016 17:57:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43382 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754008AbcFEVxQ (ORCPT ); Sun, 5 Jun 2016 17:53:16 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Feng , Vlastimil Babka , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Johannes Weiner , Tejun Heo , Zhuangluan Su , Yiping Xu , Andrew Morton , Linus Torvalds Subject: [PATCH 4.6 073/121] mm/compaction.c: fix zoneindex in kcompactd() Date: Sun, 5 Jun 2016 14:43:45 -0700 Message-Id: <20160605214419.944889790@linuxfoundation.org> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160605214417.708509043@linuxfoundation.org> References: <20160605214417.708509043@linuxfoundation.org> User-Agent: quilt/0.64 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 4.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen Feng commit 6cd9dc3e75078ef646076fa63adfb9b85ced0b66 upstream. While testing the kcompactd in my platform 3G MEM only DMA ZONE. I found the kcompactd never wakeup. It seems the zoneindex has already minus 1 before. So the traverse here should be <=. It fixes a regression where kswapd could previously compact, but kcompactd not. Not a crash fix though. [akpm@linux-foundation.org: fix kcompactd_do_work() as well, per Hugh] Link: http://lkml.kernel.org/r/1463659121-84124-1-git-send-email-puck.chen@hisilicon.com Fixes: accf62422b3a ("mm, kswapd: replace kswapd compaction with waking up kcompactd") Signed-off-by: Chen Feng Acked-by: Vlastimil Babka Cc: Hugh Dickins Cc: Michal Hocko Cc: Kirill A. Shutemov Cc: Johannes Weiner Cc: Tejun Heo Cc: Zhuangluan Su Cc: Yiping Xu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/compaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1742,7 +1742,7 @@ static bool kcompactd_node_suitable(pg_d struct zone *zone; enum zone_type classzone_idx = pgdat->kcompactd_classzone_idx; - for (zoneid = 0; zoneid < classzone_idx; zoneid++) { + for (zoneid = 0; zoneid <= classzone_idx; zoneid++) { zone = &pgdat->node_zones[zoneid]; if (!populated_zone(zone)) @@ -1777,7 +1777,7 @@ static void kcompactd_do_work(pg_data_t cc.classzone_idx); count_vm_event(KCOMPACTD_WAKE); - for (zoneid = 0; zoneid < cc.classzone_idx; zoneid++) { + for (zoneid = 0; zoneid <= cc.classzone_idx; zoneid++) { int status; zone = &pgdat->node_zones[zoneid];