2015-03-19 0:14 GMT+09:00 Jesper Krogh <jesper@xxxxxxxx>: > >> On 18/03/2015, at 15.15, Vlastimil Babka <vbabka@xxxxxxx> >> Right, it would be great if you could try it with 3.18+ kernel and possibly Joonsoo's patch from >> http://marc.info/?l=linux-mm&m=141774145601066 >> > > Thanks, we will do that. > > We actually upgraded to 3.18.9 monday (together whith moving the database from postgresql 9.2 to 9.3) and we havent seen the problem since. > > Sysload is sitting around 8-10% > > But we will test Hello, It would be really nice if you could test my patch. If possible, please test below patch rather than old one. It solves some issues commented by Vlastimil and back ported to v3.18. Thanks. --------->8------------ >From ee11da1f225c6ab3f8f40899adc6f895ab6a76b8 Mon Sep 17 00:00:00 2001 From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Date: Thu, 19 Mar 2015 21:39:01 +0900 Subject: [PATCH] mm/compaction: stop the compaction if there isn't enough freepage WARNING: This patch is just for test on v3.18 After compaction_suitable() passed, there is no check whether the system has enough memory to compact and blindly try to find freepage through iterating all memory range. This causes excessive cpu usage in low free memory condition and finally compaction would be failed. It makes sense that compaction would be stopped if there isn't enough freepage. So, this patch adds watermark check to isolate_freepages() in order to stop the compaction in this case. Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> --- mm/compaction.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index f9792ba..e87f527 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -819,6 +819,7 @@ static void isolate_freepages(struct compact_control *cc) unsigned long low_pfn; /* lowest pfn scanner is able to scan */ int nr_freepages = cc->nr_freepages; struct list_head *freelist = &cc->freepages; + unsigned long watermark = low_wmark_pages(zone) + (2UL << cc->order); /* * Initialise the free scanner. The starting point is where we last @@ -903,6 +904,15 @@ static void isolate_freepages(struct compact_control *cc) */ if (cc->contended) break; + + /* + * Watermakrs for order-0 must be met for compaction. + * See compaction_suitable for more detailed explanation. + */ + if (!(block_start_pfn % (SWAP_CLUSTER_MAX * pageblock_nr_pages)) + && !zone_watermark_ok(zone, 0, + watermark - nr_freepages, 0, 0)) + break; } /* split_free_page does not map the pages */ -- 1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>