From: Con Kolivas Avoid entering trickle_swap() when first initialising kprefetchd to prevent endless loops. Signed-off-by: Con Kolivas Signed-off-by: Andrew Morton --- mm/swap_prefetch.c | 4 ++++ 1 file changed, 4 insertions(+) diff -puN mm/swap_prefetch.c~swap-prefetch-avoid-repeating-entry mm/swap_prefetch.c --- a/mm/swap_prefetch.c~swap-prefetch-avoid-repeating-entry +++ a/mm/swap_prefetch.c @@ -515,6 +515,10 @@ static int kprefetchd(void *__unused) /* Set ioprio to lowest if supported by i/o scheduler */ sys_ioprio_set(IOPRIO_WHO_PROCESS, 0, IOPRIO_CLASS_IDLE); + /* kprefetchd has nothing to do until it is woken up the first time */ + set_current_state(TASK_INTERRUPTIBLE); + schedule(); + do { try_to_freeze(); _