From patchwork Fri May 20 23:59:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 68308 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp147131qge; Fri, 20 May 2016 16:59:09 -0700 (PDT) X-Received: by 10.98.98.69 with SMTP id w66mr8920555pfb.20.1463788749253; Fri, 20 May 2016 16:59:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id aj1si31219664pad.84.2016.05.20.16.59.09; Fri, 20 May 2016 16:59:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751669AbcETX7E (ORCPT + 3 others); Fri, 20 May 2016 19:59:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52403 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751645AbcETX7D (ORCPT ); Fri, 20 May 2016 19:59:03 -0400 Received: from y.localdomain (c-71-198-47-131.hsd1.ca.comcast.net [71.198.47.131]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7904C26C; Fri, 20 May 2016 23:59:02 +0000 (UTC) Date: Fri, 20 May 2016 16:59:02 -0700 From: akpm@linux-foundation.org To: torvalds@linux-foundation.org, mm-commits@vger.kernel.org, akpm@linux-foundation.org, puck.chen@hisilicon.com, hannes@cmpxchg.org, hughd@google.com, kirill.shutemov@linux.intel.com, mhocko@suse.com, stable@vger.kernel.org, suzhuangluan@hisilicon.com, tj@kernel.org, vbabka@suse.cz, xuyiping@hisilicon.com Subject: [patch 054/162] mm/compaction.c: fix zoneindex in kcompactd() Message-ID: <573fa4c6.J9Z0R+stDsdkroxO%akpm@linux-foundation.org> User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chen Feng Subject: mm/compaction.c: fix zoneindex in kcompactd() 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 Cc: Signed-off-by: Andrew Morton --- mm/compaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) _ -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -puN mm/compaction.c~mm-compact-fix-zoneindex-in-compact mm/compaction.c --- a/mm/compaction.c~mm-compact-fix-zoneindex-in-compact +++ a/mm/compaction.c @@ -1862,7 +1862,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)) @@ -1897,7 +1897,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];