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

Dave Chinner
2010-11-08T23:50:18Z

On Mon, Nov 08, 2010 at 06:32:04AM -0500, Christoph Hellwig wrote:
> > 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);

Yes, seems reasonable. I'll convert it to do this.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com