Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 052084a6 authored by Pradeep P V K's avatar Pradeep P V K
Browse files

bfq-iosched: Make BFQ default to IOPS mode on SSDs



BFQ idling causes reduced IOPS throughput on non-rotational disks.
Since disk head seeking is not applicable to SSDs, it doesn't really
help performance by anticipating future near-by IO requests.

Idling due to anticipation of future near-by IO requests and wait on
completion of submitted requests, will also effect the other bfq-queues
by causing delay in their scheduling and there by effecting some time
bounded applications.

By turning off idling (and switching to IOPS mode), we allow other
processes(bfq-queues) to dispatch IO requests down to the driver and
so increase IO throughput.

Following FIO benchmark results were taken on a local SSD run:

RandomReads:

 Idling   iops    avg-lat(us)    stddev      bw
 ----------------------------------------------------
 On       4136    1189.07        17221.65    16.9MB/s
 Off      7246     670.11        1054.76     29.7MB/s

fio --name=temp --size=5G --time_based --ioengine=sync \
    --randrepeat=0 --direct=1 --invalidate=1 --verify=0 \
    --verify_fatal=0 --rw=randread --blocksize=4k \
    --group_reporting=1 --directory=/data --runtime=10 \
    --iodepth=64 --numjobs=5

RandomWrites:

 Idling   iops    avg-lat(us)   stddev      bw
 ---------------------------------------------------
 On       1368    3631.38       28234.55    5.47MB/s
 Off      4746    1024.61       12184.00    19.4MB/s

fio --name=temp --size=5G --time_based --ioengine=sync \
    --randrepeat=0  --direct=1 --invalidate=1 --verify=0 \
    --verify_fatal=0 --rw=randwrite --blocksize=4k \
    --group_reporting=1 --directory=/data --runtime=10 \
    --iodepth=64 --numjobs=5

Change-Id: I9e55eee03917a1ab07fbd3f04635ca1a6541b860
Signed-off-by: default avatarPradeep P V K <ppvk@codeaurora.org>
parent e375eb21
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -5425,6 +5425,18 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
	return -ENOMEM;
}

static void bfq_registered_queue(struct request_queue *q)
{
	struct elevator_queue *e = q->elevator;
	struct bfq_data *bfqd = e->elevator_data;

	/*
	 * Default to IOPS mode with no idling for SSDs
	 */
	if (blk_queue_nonrot(q))
		bfqd->bfq_slice_idle = 0;
}

static void bfq_slab_kill(void)
{
	kmem_cache_destroy(bfq_pool);
@@ -5672,6 +5684,7 @@ static struct elevator_type iosched_bfq_mq = {
		.init_hctx		= bfq_init_hctx,
		.init_sched		= bfq_init_queue,
		.exit_sched		= bfq_exit_queue,
		.elevator_registered_fn = bfq_registered_queue,
	},

	.uses_mq =		true,
+2 −0
Original line number Diff line number Diff line
@@ -856,6 +856,8 @@ int elv_register_queue(struct request_queue *q)
		e->registered = 1;
		if (!e->uses_mq && e->type->ops.sq.elevator_registered_fn)
			e->type->ops.sq.elevator_registered_fn(q);
		else if (e->uses_mq && e->type->ops.mq.elevator_registered_fn)
			e->type->ops.mq.elevator_registered_fn(q);
	}
	return error;
}
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ struct elevator_mq_ops {
	struct request *(*next_request)(struct request_queue *, struct request *);
	void (*init_icq)(struct io_cq *);
	void (*exit_icq)(struct io_cq *);
	void (*elevator_registered_fn)(struct request_queue *q);
};

#define ELV_NAME_MAX	(16)