From: Tao Zeng Date: Thu, 6 Dec 2018 07:24:44 +0000 (+0800) Subject: mm: subtract CMA isolated pages when allocate TVP [1/1] X-Git-Tag: hardkernel-4.9.236-104~2068 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0313e6ddde2b423cba94169f81d4243b7f54390e;p=platform%2Fkernel%2Flinux-amlogic.git mm: subtract CMA isolated pages when allocate TVP [1/1] PD#SWPL-2933 Problem: When allocate CMA pages in buildroot enverioment, system will hung in congestion_wait: Call trace: [] __switch_to+0xa0/0xc8 [] __schedule+0x268/0x7d8 [] schedule+0x3c/0xa0 [] schedule_timeout+0x1b4/0x448 [] io_schedule_timeout+0x98/0x100 [] congestion_wait+0x90/0x190 [] isolate_migratepages_block+0x7ec/0x890 [] isolate_migratepages_range+0x8c/0x100 [] aml_alloc_contig_migrate_range+0x104/0x158 [] cma_boost_work_func+0x178/0x270 [] kthread+0xf8/0x110 [] ret_from_fork+0x10/0x50 Solution: subtract isolated CMA pages when allocation large CMA for TVP. Verify: local Change-Id: I96153cf104abb009a8965c2230a5242e495dd031 Signed-off-by: Tao Zeng --- diff --git a/mm/compaction.c b/mm/compaction.c index 2d9ee59..e35f491 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -637,7 +637,11 @@ isolate_freepages_range(struct compact_control *cc, /* Similar to reclaim, but different enough that they don't share logic */ static bool too_many_isolated(struct zone *zone) { +#ifdef CONFIG_AMLOGIC_CMA + signed long active, inactive, isolated; +#else unsigned long active, inactive, isolated; +#endif inactive = node_page_state(zone->zone_pgdat, NR_INACTIVE_FILE) + node_page_state(zone->zone_pgdat, NR_INACTIVE_ANON); @@ -646,6 +650,13 @@ static bool too_many_isolated(struct zone *zone) isolated = node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE) + node_page_state(zone->zone_pgdat, NR_ISOLATED_ANON); +#ifdef CONFIG_AMLOGIC_CMA + isolated -= global_page_state(NR_CMA_ISOLATED); + WARN_ONCE(isolated > (inactive + active) / 2, + "isolated:%ld, cma:%ld, inactive:%ld, active:%ld\n", + isolated, global_page_state(NR_CMA_ISOLATED), + inactive, active); +#endif /* CONFIG_AMLOGIC_CMA */ return isolated > (inactive + active) / 2; } #ifdef CONFIG_AMLOGIC_CMA