Re: [PATCH] thp: reduce khugepaged freezing latency

From: Andrea Arcangeli
Date: Wed Nov 09 2011 - 12:33:20 EST


On Wed, Nov 09, 2011 at 09:06:57AM -0800, Tejun Heo wrote:
> Ah, crap, still waking up. Sorry about that. So, yes, there's a race
> condition above. You need to set TASK_INTERRUPTIBLE before testing
> freezing and use schedule_timeout() instead of

Yep that's the race I was thinking about. I see the wakeup in the
no-signal case avoids the race in wait_even_freezable_timeout so that
is ok but it'd race if I were just to add try_to_freeze before calling
schedule_timeout_interruptible.

> schedule_timeout_interruptible(). Was getting confused with
> prepare_to_wait(). That said, why not use prepare_to_wait() instead?

Because I don't need to wait on a waitqueue there. A THP failure
occurred, that caused some CPU overload and it's usually happening at
time of heavy VM stress, so I don't want to retry and cause more CPU
load from khugepaged until after some time even if more wakeups come
by. khugepaged is a very low cost background op, so it shouldn't cause
unnecessary CPU usage at times of VM pressure, waiting a better time
later is better.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/