linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Add WARN_ON for possibility of infinite loop if empty lists in free_pcppages_bulk'
@ 2016-08-19 12:15 Pankaj Gupta
  2016-08-19 12:45 ` Mel Gorman
  0 siblings, 1 reply; 5+ messages in thread
From: Pankaj Gupta @ 2016-08-19 12:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, akpm, vbabka, mgorman, riel, hannes, iamjoonsoo.kim,
	kirill.shutemov, izumi.taku

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 <pagupta@redhat.com>
---
 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-23  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-19 12:15 [PATCH] mm: Add WARN_ON for possibility of infinite loop if empty lists in free_pcppages_bulk' Pankaj Gupta
2016-08-19 12:45 ` Mel Gorman
2016-08-19 13:07   ` Pankaj Gupta
2016-08-19 14:00     ` Mel Gorman
2016-08-23  8:48       ` Pankaj Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).