mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corrado Zoccolo <czoccolo@gmail.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jens.axboe@oracle.com" <jens.axboe@oracle.com>,
	"jmoyer@redhat.com" <jmoyer@redhat.com>,
	"Zhang, Yanmin" <yanmin.zhang@intel.com>
Subject: Re: [PATCH]cfq-iosched: split seeky coop queues after one slice
Date: Mon, 28 Dec 2009 09:40:30 +0100	[thread overview]
Message-ID: <4e5e476b0912280040ue2eb50ftd3945f28270899c0@mail.gmail.com> (raw)
In-Reply-To: <20091228031951.GA15242@sli10-desk.sh.intel.com>

On Mon, Dec 28, 2009 at 4:19 AM, Shaohua Li <shaohua.li@intel.com> wrote:
> On Fri, Dec 25, 2009 at 06:16:27PM +0800, Corrado Zoccolo wrote:
>> Hi Shaohua,
>> On Thu, Dec 24, 2009 at 1:55 AM, Shaohua Li <shaohua.li@intel.com> wrote:
>> > df5fe3e8e13883f58dc97489076bbcc150789a21
>> > b3b6d0408c953524f979468562e7e210d8634150
>> > The coop merge is too aggressive. For example, if two tasks are reading two
>> > files where the two files have some adjecent blocks, cfq will immediately
>> > merge them. cfq_rq_close() also has trouble, sometimes the seek_mean is very
>> > big. I did a test to make cfq_rq_close() always checks the distence according
>> > to CIC_SEEK_THR, but still saw a lot of wrong merge. (BTW, why we take a long
>> > distence far away request as close. Taking them close doesn't improve any thoughtput
>> > to me. Maybe we should always use CIC_SEEK_THR as close criteria).
>> Yes, when deciding if two queues are going to be merged, we should use
>> the constant CIC_SEEK_THR.
>> > So sounds we need make split more aggressive. But the split is too lazay,
>> > which requires to wait 1s. Time based check isn't reliable as queue might not
>> > run at given time, so uses a small time isn't ok.
>> 1s is too much, but I wouldn't abandon a time based approach. To fix
>> the problem of queue not being run, you can consider a slice. If at
>> the end of the slice, the queue is seeky, you split it.
>
> Currently we split seeky coop queues after 1s, which is too big. Below patch
> marks seeky coop queue split_coop flag after one slice. After that, if new
> requests come in, the queues will be splitted. Patch is suggested by Corrado.
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
You can also remove the no longer used define:
#define CFQQ_COOP_TOUT          (HZ)

Reviewed-by: Corrado Zoccolo <czoccolo@gmail.com>

>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index e2f8046..d4d5cca 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -52,6 +52,9 @@ static const int cfq_hist_divisor = 4;
>  #define CFQ_HW_QUEUE_MIN       (5)
>  #define CFQ_SERVICE_SHIFT       12
>
> +#define CFQQ_SEEK_THR          8 * 1024
> +#define CFQQ_SEEKY(cfqq)       ((cfqq)->seek_mean > CFQQ_SEEK_THR)
> +
>  #define RQ_CIC(rq)             \
>        ((struct cfq_io_context *) (rq)->elevator_private)
>  #define RQ_CFQQ(rq)            (struct cfq_queue *) ((rq)->elevator_private2)
> @@ -137,7 +140,6 @@ struct cfq_queue {
>        u64 seek_total;
>        sector_t seek_mean;
>        sector_t last_request_pos;
> -       unsigned long seeky_start;
>
>        pid_t pid;
>
> @@ -317,6 +319,7 @@ enum cfqq_state_flags {
>        CFQ_CFQQ_FLAG_slice_new,        /* no requests dispatched in slice */
>        CFQ_CFQQ_FLAG_sync,             /* synchronous queue */
>        CFQ_CFQQ_FLAG_coop,             /* cfqq is shared */
> +       CFQ_CFQQ_FLAG_split_coop,       /* shared cfqq will be splitted */
>        CFQ_CFQQ_FLAG_deep,             /* sync cfqq experienced large depth */
>        CFQ_CFQQ_FLAG_wait_busy,        /* Waiting for next request */
>  };
> @@ -345,6 +348,7 @@ CFQ_CFQQ_FNS(prio_changed);
>  CFQ_CFQQ_FNS(slice_new);
>  CFQ_CFQQ_FNS(sync);
>  CFQ_CFQQ_FNS(coop);
> +CFQ_CFQQ_FNS(split_coop);
>  CFQ_CFQQ_FNS(deep);
>  CFQ_CFQQ_FNS(wait_busy);
>  #undef CFQ_CFQQ_FNS
> @@ -1574,6 +1578,15 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
>        cfq_clear_cfqq_wait_busy(cfqq);
>
>        /*
> +        * If this cfqq is shared between multiple processes, check to
> +        * make sure that those processes are still issuing I/Os within
> +        * the mean seek distance.  If not, it may be time to break the
> +        * queues apart again.
> +        */
> +       if (cfq_cfqq_coop(cfqq) && CFQQ_SEEKY(cfqq))
> +               cfq_mark_cfqq_split_coop(cfqq);
> +
> +       /*
>         * store what was left of this slice, if the queue idled/timed out
>         */
>        if (timed_out && !cfq_cfqq_slice_new(cfqq)) {
> @@ -1671,9 +1684,6 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
>                return cfqd->last_position - blk_rq_pos(rq);
>  }
>
> -#define CFQQ_SEEK_THR          8 * 1024
> -#define CFQQ_SEEKY(cfqq)       ((cfqq)->seek_mean > CFQQ_SEEK_THR)
> -
>  static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
>                               struct request *rq)
>  {
> @@ -3027,19 +3037,6 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq,
>        total = cfqq->seek_total + (cfqq->seek_samples/2);
>        do_div(total, cfqq->seek_samples);
>        cfqq->seek_mean = (sector_t)total;
> -
> -       /*
> -        * If this cfqq is shared between multiple processes, check to
> -        * make sure that those processes are still issuing I/Os within
> -        * the mean seek distance.  If not, it may be time to break the
> -        * queues apart again.
> -        */
> -       if (cfq_cfqq_coop(cfqq)) {
> -               if (CFQQ_SEEKY(cfqq) && !cfqq->seeky_start)
> -                       cfqq->seeky_start = jiffies;
> -               else if (!CFQQ_SEEKY(cfqq))
> -                       cfqq->seeky_start = 0;
> -       }
>  }
>
>  /*
> @@ -3474,14 +3471,6 @@ cfq_merge_cfqqs(struct cfq_data *cfqd, struct cfq_io_context *cic,
>        return cic_to_cfqq(cic, 1);
>  }
>
> -static int should_split_cfqq(struct cfq_queue *cfqq)
> -{
> -       if (cfqq->seeky_start &&
> -           time_after(jiffies, cfqq->seeky_start + CFQQ_COOP_TOUT))
> -               return 1;
> -       return 0;
> -}
> -
>  /*
>  * Returns NULL if a new cfqq should be allocated, or the old cfqq if this
>  * was the last process referring to said cfqq.
> @@ -3490,9 +3479,9 @@ static struct cfq_queue *
>  split_cfqq(struct cfq_io_context *cic, struct cfq_queue *cfqq)
>  {
>        if (cfqq_process_refs(cfqq) == 1) {
> -               cfqq->seeky_start = 0;
>                cfqq->pid = current->pid;
>                cfq_clear_cfqq_coop(cfqq);
> +               cfq_clear_cfqq_split_coop(cfqq);
>                return cfqq;
>        }
>
> @@ -3531,7 +3520,7 @@ new_queue:
>                /*
>                 * If the queue was seeky for too long, break it apart.
>                 */
> -               if (cfq_cfqq_coop(cfqq) && should_split_cfqq(cfqq)) {
> +               if (cfq_cfqq_coop(cfqq) && cfq_cfqq_split_coop(cfqq)) {
>                        cfq_log_cfqq(cfqd, cfqq, "breaking apart cfqq");
>                        cfqq = split_cfqq(cic, cfqq);
>                        if (!cfqq)
>

  reply	other threads:[~2009-12-28  8:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-24  0:55 cfq-iosched: tiobench regression Shaohua Li
2009-12-24  7:48 ` Gui Jianfeng
2009-12-24  9:19   ` Shaohua Li
2009-12-24 11:40     ` Corrado Zoccolo
2009-12-25 10:16 ` Corrado Zoccolo
2009-12-28  2:02   ` Shaohua Li
2009-12-28  2:03   ` [PATCH]cfq-iosched: don't take requests with long distence as close Shaohua Li
2009-12-28  8:36     ` Corrado Zoccolo
2009-12-28  8:46       ` Shaohua Li
2009-12-28  9:11         ` Corrado Zoccolo
2009-12-28  9:28           ` Shaohua Li
2009-12-28  9:40             ` Corrado Zoccolo
2009-12-28 12:16             ` Jens Axboe
2010-01-04 14:58             ` Jeff Moyer
2010-01-05 21:16             ` Jeff Moyer
2010-01-06  1:19               ` Li, Shaohua
2010-01-07 13:44               ` Corrado Zoccolo
2010-01-07 14:30                 ` Jeff Moyer
2010-01-11  5:20                   ` Zhang, Yanmin
2010-01-11 15:05                     ` Corrado Zoccolo
2010-01-12  2:43                       ` Zhang, Yanmin
2010-01-15 19:32                         ` Corrado Zoccolo
2010-01-15 19:45                           ` Jeff Moyer
2010-01-15 20:24                             ` Corrado Zoccolo
2010-01-15 20:26                               ` Jeff Moyer
2009-12-28  3:19   ` [PATCH]cfq-iosched: split seeky coop queues after one slice Shaohua Li
2009-12-28  8:40     ` Corrado Zoccolo [this message]
2009-12-28  8:52       ` Shaohua Li
2010-01-04 15:04         ` Jeff Moyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e5e476b0912280040ue2eb50ftd3945f28270899c0@mail.gmail.com \
    --to=czoccolo@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.com \
    --cc=yanmin.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®