sched: change sleep api for __migration_entry_wait [1/1]
authorTao Zeng <tao.zeng@amlogic.com>
Mon, 8 Jul 2019 02:36:26 +0000 (10:36 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Mon, 15 Jul 2019 02:53:55 +0000 (19:53 -0700)
PD#TV-7519

Problem:
schedule_timeout did not really make task sleep. It will cause
rt thread bug when this thread is waiting for a cma page migrated:
sched: RT throttling activated for rt_rq eaf671b8 (cpu 1)
potential CPU hogs:
        btu message loo (4253)
[<c037d5b8>] task_tick_rt+0x0/0x120
[<c037d914>] pick_next_task_rt+0x1cc/0x1e4
[<c0fa8534>] __schedule+0x598/0x91c
[<c0fa891c>] schedule+0x64/0xc4
[<c0fac134>] schedule_timeout+0x1dc/0x47c
[<c0493ba4>] __migration_entry_wait+0x168/0x194
               ~~~~~blocked here
[<c0493c20>] migration_entry_wait+0x50/0x54
[<c0473008>] do_swap_page+0x404/0x4e8
[<c047357c>] handle_mm_fault+0x1ec/0xa60
[<c031a2f0>] do_page_fault+0x2d4/0x3a8
[<c0301408>] do_PrefetchAbort+0x48/0xb0
[<c030f78c>] ret_from_exception+0x0/0x34

Solution:
using usleep_range instead of schedule_timeout

Verify:
t905x

Change-Id: I908022b747ad921b5863af377291abdf06672f15
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
mm/migrate.c

index bdee2ba..42d98ab 100644 (file)
@@ -41,6 +41,9 @@
 #include <linux/page_idle.h>
 #include <linux/page_owner.h>
 #include <linux/ptrace.h>
+#ifdef CONFIG_AMLOGIC_CMA
+#include <linux/delay.h>
+#endif
 
 #include <asm/tlbflush.h>
 
@@ -348,7 +351,7 @@ out:
        pte_unmap_unlock(ptep, ptl);
 #ifdef CONFIG_AMLOGIC_CMA
        if (need_wait)
-               schedule_timeout(1);
+               usleep_range(1000, 1100);
 #endif
 }