xfs
[Top] [All Lists]

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

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 13/16] xfs: reduce the number of AIL push wakeups
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 8 Nov 2010 06:32:04 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1289206519-18377-14-git-send-email-david@xxxxxxxxxxxxx>
References: <1289206519-18377-1-git-send-email-david@xxxxxxxxxxxxx> <1289206519-18377-14-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
>  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);

<Prev in Thread] Current Thread [Next in Thread>