From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754408AbcHSMQR (ORCPT ); Fri, 19 Aug 2016 08:16:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38826 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750889AbcHSMQQ (ORCPT ); Fri, 19 Aug 2016 08:16:16 -0400 From: Pankaj Gupta To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, vbabka@suse.cz, mgorman@techsingularity.net, riel@redhat.com, hannes@cmpxchg.org, iamjoonsoo.kim@lge.com, kirill.shutemov@linux.intel.com, izumi.taku@jp.fujitsu.com Subject: [PATCH] mm: Add WARN_ON for possibility of infinite loop if empty lists in free_pcppages_bulk' Date: Fri, 19 Aug 2016 17:45:18 +0530 Message-Id: <1471608918-5101-1-git-send-email-pagupta@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 19 Aug 2016 12:15:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While debugging issue in realtime kernel i found a scenario which resulted in infinite loop resulting because of empty pcp->lists and valid 'to_free' value. This patch is to add 'WARN_ON' in function 'free_pcppages_bulk' if there is possibility of infinite loop because of any bug in code. Signed-off-by: Pankaj Gupta --- mm/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3fbe73a..07d3080 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1096,6 +1096,8 @@ static void free_pcppages_bulk(struct zone *zone, int count, if (++migratetype == MIGRATE_PCPTYPES) migratetype = 0; list = &pcp->lists[migratetype]; + + WARN_ON(batch_free > MIGRATE_PCPTYPES); } while (list_empty(list)); /* This is the only non-empty list. Free them all. */ -- 2.7.4