Re: [PATCH 13/16] xfs: reduce the number of AIL push wakeups

Christoph Hellwig
2010-11-08T11:30:38Z

> STATIC int
> @@ -850,8 +853,17 @@ xfsaild(
> long tout = 0; /* milliseconds */
>
> while (!kthread_should_stop()) {
> - schedule_timeout_interruptible(tout ?
> + /*
> + * for short sleeps indicating congestion, don't allow us to
> + * get woken early. Otherwise all we do is bang on the AIL lock
> + * without making progress.
> + */
> + if (tout && tout <= 20) {
> + schedule_timeout_uninterruptible(msecs_to_jiffies(tout));
> + } else {
> + schedule_timeout_interruptible(tout ?
> msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT);
> + }

How about just setting the state ourselves and calling schedule_timeout?
That seems a lot more readable to me. Also we can switch to
TASK_KILLABLE for the short sleeps, just to not introduce any delay
in shutting down aild when kthread_stop is called. It would look
something like this:

if (tout && tout <= 20)
__set_current_state(TASK_KILLABLE);
else
__set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(tout ?
msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT);