Skip to contentSkip to conversation

Give kjournald a IOPRIO_CLASS_RT io priority

PATCH Bodo Eggert 4 participants 7 messages Oct 2, 2008 – Oct 9, 2008 6 messages not in the archive Block layer

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 14 lines · Jens Axboe
Quoted 6 lines · Dave Chinner
Quoted 3 lines · Jens Axboe

Good point. I think we should mark the IO as sync, and maintain the same priority level. Any IO that ends up being waited on is sync by definition, we just need to expand the coverage a bit.

Quoted 6 lines

That's what XFS has always done - mark the journal I/O as sync. Still, once you load up the elevator, the sync I/O can still get delayed for hundreds of milliseconds before dispatch, which was why I started looking at boosting the priority of the log I/O. It proved to be much more effective at getting the log I/O dispatched than the existing "mark it sync" technique....

Quoted 4 lines

Sure, just marking it as sync is not a magic bullet. It'll be in the first priority for that class, but it'll share bandwidth with other processes. So if you have lots of IO going on, it can take hundreds of miliseconds before being dispatched.

Sounds like you need a priority class besides sync and async.

#7 lore raw
Quoted 15 lines · Bodo Eggert
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Dave Chinner
Quoted 3 lines · Jens Axboe

Good point. I think we should mark the IO as sync, and maintain the same priority level. Any IO that ends up being waited on is sync by definition, we just need to expand the coverage a bit.

That's what XFS has always done - mark the journal I/O as sync. Still, once you load up the elevator, the sync I/O can still get delayed for hundreds of milliseconds before dispatch, which was why I started looking at boosting the priority of the log I/O. It proved to be much more effective at getting the log I/O dispatched than the existing "mark it sync" technique....

Quoted 6 lines
Quoted 4 lines

Sure, just marking it as sync is not a magic bullet. It'll be in the first priority for that class, but it'll share bandwidth with other processes. So if you have lots of IO going on, it can take hundreds of miliseconds before being dispatched.

Sounds like you need a priority class besides sync and async.

There's BIO_META now as well, which I was testing at the same time as RT priority. Marking all the metadata I/O as BIO_META did help, but once again I never got to determining if that was a result of the different tagging or the priority increase.

However, given that only CFQ understand BIO_META, I suspect that changing the way XFS uses BIO_SYNC to be a combination of BIO_META and BIO_SYNC would cause significant regressions on other schedulers.....

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#8 lore raw
Quoted 7 lines · Dave Chinner
Quoted 1 line · Bodo Eggert

Sounds like you need a priority class besides sync and async.

There's BIO_META now as well, which I was testing at the same time as RT priority. Marking all the metadata I/O as BIO_META did help, but once again I never got to determining if that was a result of the different tagging or the priority increase.

What exactly do you want META to mean? Strict prioritisation over all other non-META requests, or just more frequent and/or larger dispatches? Should META requests be sorted?

Quoted 4 lines

However, given that only CFQ understand BIO_META, I suspect that changing the way XFS uses BIO_SYNC to be a combination of BIO_META and BIO_SYNC would cause significant regressions on other schedulers.....

That shouldn't be a problem. noop doesn't care about any of that stuff, and deadline doesn't care about BIO_SYNC (more on that below). If the bios that use META are a subset of those that currently use SYNC, then we can temporarily change AS to treat META and SYNC equally. Only CFQ would change in behaviour.

So deadline should probably support BIO_SYNC... below is a patch to do that. It doesn't have much of an effect on postmark or compilebench on a single spindle, but I'm guessing that's not the workload or hardware that is expected to benefit.

---

Subject: [PATCH] deadline-iosched: support SYNC bio/request flag

Support sync/async requests in deadline rather than read/write, as is done in AS and CFQ.

---
block/deadline-iosched.c | 63 ++++++++++++++++++++++++---------------------

1 files changed, 34 insertions(+), 29 deletions(-)
block/deadline-iosched.c +0 -0
index 342448c..b2cfd47 100644
@@ -23,6 +23,11 @@ static const int writes_starved = 2;    /* max times reads can starve a write */

static const int fifo_batch = 16; /* # of sequential requests treated as one
by the above parameters. For throughput. */

+enum {
+ REQ_ASYNC,
+ REQ_SYNC,
+};
+

struct deadline_data {
	/*
	 * run time data

@@ -53,7 +58,7 @@ struct deadline_data {

static void deadline_move_request(struct deadline_data *, struct request *);

-#define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_data_dir((rq))])
+#define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_is_sync((rq))])

/*
* get the request after `rq' in sector-sorted order
@@ -86,7 +91,7 @@ retry:
static inline void
deadline_del_rq_rb(struct deadline_data *dd, struct request *rq) {
- const int data_dir = rq_data_dir(rq);
+ const int data_dir = rq_is_sync(rq);

	if (dd->next_rq[data_dir] == rq)
		dd->next_rq[data_dir] = deadline_latter_request(rq);
@@ -101,7 +106,7 @@ static void
deadline_add_request(struct request_queue *q, struct request *rq)
{
	struct deadline_data *dd = q->elevator->elevator_data;

- const int data_dir = rq_data_dir(rq);
+ const int data_dir = rq_is_sync(rq);

	deadline_add_rq_rb(dd, rq);

@@ -206,10 +211,10 @@ deadline_move_to_dispatch(struct deadline_data *dd, struct request *rq) static void
deadline_move_request(struct deadline_data *dd, struct request *rq)
{
- const int data_dir = rq_data_dir(rq);
+ const int data_dir = rq_is_sync(rq);

- dd->next_rq[READ] = NULL;
- dd->next_rq[WRITE] = NULL;
+ dd->next_rq[REQ_SYNC] = NULL;

+	dd->next_rq[REQ_ASYNC] = NULL;
	dd->next_rq[data_dir] = deadline_latter_request(rq);

	dd->last_sector = rq->sector + rq->nr_sectors;
@@ -245,18 +250,18 @@ static inline int deadline_check_fifo(struct deadline_data *dd, int ddir)
static int deadline_dispatch_requests(struct request_queue *q, int force)
{
	struct deadline_data *dd = q->elevator->elevator_data;
-	const int reads = !list_empty(&dd->fifo_list[READ]);
-	const int writes = !list_empty(&dd->fifo_list[WRITE]);
+	const int reads = !list_empty(&dd->fifo_list[REQ_SYNC]);
+	const int writes = !list_empty(&dd->fifo_list[REQ_ASYNC]);
	struct request *rq;
	int data_dir;

	/*
	 * batches are currently reads XOR writes
	 */

- if (dd->next_rq[WRITE])
- rq = dd->next_rq[WRITE];
+ if (dd->next_rq[REQ_ASYNC])
+ rq = dd->next_rq[REQ_ASYNC];
else
- rq = dd->next_rq[READ];
+ rq = dd->next_rq[REQ_SYNC];

	if (rq) {
		/* we have a "next request" */
@@ -276,12 +281,12 @@ static int deadline_dispatch_requests(struct request_queue *q, int force)
	 */

	if (reads) {

- BUG_ON(RB_EMPTY_ROOT(&dd->sort_list[READ]));
+ BUG_ON(RB_EMPTY_ROOT(&dd->sort_list[REQ_SYNC]));

		if (writes && (dd->starved++ >= dd->writes_starved))
			goto dispatch_writes;

- data_dir = READ;
+ data_dir = REQ_SYNC;

		goto dispatch_find_request;
	}

@@ -292,11 +297,11 @@ static int deadline_dispatch_requests(struct request_queue *q, int force)

	if (writes) {

dispatch_writes:
- BUG_ON(RB_EMPTY_ROOT(&dd->sort_list[WRITE]));
+ BUG_ON(RB_EMPTY_ROOT(&dd->sort_list[REQ_ASYNC]));

		dd->starved = 0;

- data_dir = WRITE;
+ data_dir = REQ_ASYNC;

		goto dispatch_find_request;
	}
@@ -338,16 +343,16 @@ static int deadline_queue_empty(struct request_queue *q)
{
	struct deadline_data *dd = q->elevator->elevator_data;

- return list_empty(&dd->fifo_list[WRITE])
- && list_empty(&dd->fifo_list[READ]);
+ return list_empty(&dd->fifo_list[REQ_ASYNC])
+ && list_empty(&dd->fifo_list[REQ_SYNC]);
}

static void deadline_exit_queue(elevator_t *e)

{
	struct deadline_data *dd = e->elevator_data;

- BUG_ON(!list_empty(&dd->fifo_list[READ]));
- BUG_ON(!list_empty(&dd->fifo_list[WRITE]));
+ BUG_ON(!list_empty(&dd->fifo_list[REQ_SYNC]));
+ BUG_ON(!list_empty(&dd->fifo_list[REQ_ASYNC]));

	kfree(dd);
}
@@ -363,12 +368,12 @@ static void *deadline_init_queue(struct request_queue *q)
	if (!dd)
		return NULL;

- INIT_LIST_HEAD(&dd->fifo_list[READ]);
- INIT_LIST_HEAD(&dd->fifo_list[WRITE]);
- dd->sort_list[READ] = RB_ROOT;
- dd->sort_list[WRITE] = RB_ROOT;
- dd->fifo_expire[READ] = read_expire;
- dd->fifo_expire[WRITE] = write_expire;
+ INIT_LIST_HEAD(&dd->fifo_list[REQ_SYNC]);
+ INIT_LIST_HEAD(&dd->fifo_list[REQ_ASYNC]);
+ dd->sort_list[REQ_SYNC] = RB_ROOT;
+ dd->sort_list[REQ_ASYNC] = RB_ROOT;
+ dd->fifo_expire[REQ_SYNC] = read_expire;

+	dd->fifo_expire[REQ_ASYNC] = write_expire;
	dd->writes_starved = writes_starved;
	dd->front_merges = 1;
	dd->fifo_batch = fifo_batch;
@@ -403,8 +408,8 @@ static ssize_t __FUNC(elevator_t *e, char *page)			\
		__data = jiffies_to_msecs(__data);			\
	return deadline_var_show(__data, (page));			\
}

-SHOW_FUNCTION(deadline_read_expire_show, dd->fifo_expire[READ], 1); -SHOW_FUNCTION(deadline_write_expire_show, dd->fifo_expire[WRITE], 1); +SHOW_FUNCTION(deadline_read_expire_show, dd->fifo_expire[REQ_SYNC], 1); +SHOW_FUNCTION(deadline_write_expire_show, dd->fifo_expire[REQ_ASYNC], 1); SHOW_FUNCTION(deadline_writes_starved_show, dd->writes_starved, 0); SHOW_FUNCTION(deadline_front_merges_show, dd->front_merges, 0); SHOW_FUNCTION(deadline_fifo_batch_show, dd->fifo_batch, 0);

@@ -426,8 +431,8 @@ static ssize_t __FUNC(elevator_t *e, const char *page, size_t count)	\
		*(__PTR) = __data;					\
	return ret;							\
}

-STORE_FUNCTION(deadline_read_expire_store, &dd->fifo_expire[READ], 0, INT_MAX, 1); -STORE_FUNCTION(deadline_write_expire_store, &dd->fifo_expire[WRITE], 0, INT_MAX, 1); +STORE_FUNCTION(deadline_read_expire_store, &dd->fifo_expire[REQ_SYNC], 0, INT_MAX, 1); +STORE_FUNCTION(deadline_write_expire_store, &dd->fifo_expire[REQ_ASYNC], 0, INT_MAX, 1); STORE_FUNCTION(deadline_writes_starved_store, &dd->writes_starved, INT_MIN, INT_MAX, 0); STORE_FUNCTION(deadline_front_merges_store, &dd->front_merges, 0, 1, 0); STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0);

Signature · 1 line
1.6.0.2
#9 lore raw
Quoted 4 lines · Aaron Carroll
Quoted 3 lines · Dave Chinner
Quoted 1 line · Bodo Eggert

Sounds like you need a priority class besides sync and async.

Quoted 8 lines
Quoted 4 lines

There's BIO_META now as well, which I was testing at the same time as RT priority. Marking all the metadata I/O as BIO_META did help, but once again I never got to determining if that was a result of the different tagging or the priority increase.

What exactly do you want META to mean? Strict prioritisation over all other non-META requests, or just more frequent and/or larger dispatches? Should META requests be sorted?

The real question is "what was it supposed to mean"? AFAICT, it was added to a couple of filesystems to be used to tag superblock read I/O. Why - I don't know - there's a distinct lack of documentation surrounding these bio flags. :/

Realistically, I'm not sure that having a separate queue for BIO_META will buy us anything, given that noop is quite often the fastest scheduler for XFS because it enables interleaved metadata I/O to be merged with data I/O. Like I said, I was not able to spend the time to determine exactly how BIO_META affected I/O patterns, so I can't really comment on whether it is really necessary or not.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#10 lore raw
Quoted 10 lines · Dave Chinner
Quoted 9 lines · Aaron Carroll
Quoted 7 lines · Dave Chinner
Quoted 1 line · Bodo Eggert

Sounds like you need a priority class besides sync and async.

There's BIO_META now as well, which I was testing at the same time as RT priority. Marking all the metadata I/O as BIO_META did help, but once again I never got to determining if that was a result of the different tagging or the priority increase.

Quoted 8 lines
Quoted 3 lines

What exactly do you want META to mean? Strict prioritisation over all other non-META requests, or just more frequent and/or larger dispatches? Should META requests be sorted?

The real question is "what was it supposed to mean"? AFAICT, it was added to a couple of filesystems to be used to tag superblock read I/O. Why - I don't know - there's a distinct lack of documentation surrounding these bio flags. :/

It was added to be able to differentiate between data and meta data IO when using blktrace, that is all.

Quoted 6 lines

Realistically, I'm not sure that having a separate queue for BIO_META will buy us anything, given that noop is quite often the fastest scheduler for XFS because it enables interleaved metadata I/O to be merged with data I/O. Like I said, I was not able to spend the time to determine exactly how BIO_META affected I/O patterns, so I can't really comment on whether it is really necessary or not.

There's no seperate queue for meta data IO anywhere. CFQ will give _slight_ preference to meta data IO as a side effect, preferring the meta IO for otherwise same IO in what to serve next in the same queue. And it will not allow preemption of a meta data IO for a data IO.

So using meta should not yield any important boosts by itself.

Signature · 1 line
Jens Axboe
#11 lore raw
Quoted 15 lines · Jens Axboe
Quoted 14 lines · Dave Chinner
Quoted 12 lines · Aaron Carroll
Quoted 7 lines · Dave Chinner
Quoted 1 line · Bodo Eggert

Sounds like you need a priority class besides sync and async.

There's BIO_META now as well, which I was testing at the same time as RT priority. Marking all the metadata I/O as BIO_META did help, but once again I never got to determining if that was a result of the different tagging or the priority increase.

What exactly do you want META to mean? Strict prioritisation over all other non-META requests, or just more frequent and/or larger dispatches? Should META requests be sorted?

Quoted 7 lines
Quoted 4 lines

The real question is "what was it supposed to mean"? AFAICT, it was added to a couple of filesystems to be used to tag superblock read I/O. Why - I don't know - there's a distinct lack of documentation surrounding these bio flags. :/

It was added to be able to differentiate between data and meta data IO when using blktrace, that is all.

Ok.

Quoted 7 lines
Quoted 6 lines

Realistically, I'm not sure that having a separate queue for BIO_META will buy us anything, given that noop is quite often the fastest scheduler for XFS because it enables interleaved metadata I/O to be merged with data I/O. Like I said, I was not able to spend the time to determine exactly how BIO_META affected I/O patterns, so I can't really comment on whether it is really necessary or not.

Quoted 6 lines

There's no seperate queue for meta data IO anywhere. CFQ will give _slight_ preference to meta data IO as a side effect, preferring the meta IO for otherwise same IO in what to serve next in the same queue. And it will not allow preemption of a meta data IO for a data IO.

So using meta should not yield any important boosts by itself.

Which means that performance increase I saw on CFQ was a result of removing the BIO_SYNC tagging "optimisation" XFS uses for metadata, not from adding BIO_META.....

Could you please document what these tags actually mean and do so that other people don't get as confused as me about this stuff....

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#12 lore raw
Quoted 40 lines · Dave Chinner
Quoted 15 lines · Jens Axboe
Quoted 14 lines · Dave Chinner
Quoted 12 lines · Aaron Carroll
Quoted 7 lines · Dave Chinner
Quoted 1 line · Bodo Eggert

Sounds like you need a priority class besides sync and async.

There's BIO_META now as well, which I was testing at the same time as RT priority. Marking all the metadata I/O as BIO_META did help, but once again I never got to determining if that was a result of the different tagging or the priority increase.

What exactly do you want META to mean? Strict prioritisation over all other non-META requests, or just more frequent and/or larger dispatches? Should META requests be sorted?

Quoted 7 lines
Quoted 4 lines

The real question is "what was it supposed to mean"? AFAICT, it was added to a couple of filesystems to be used to tag superblock read I/O. Why - I don't know - there's a distinct lack of documentation surrounding these bio flags. :/

It was added to be able to differentiate between data and meta data IO when using blktrace, that is all.

Ok.

Quoted 7 lines
Quoted 6 lines

Realistically, I'm not sure that having a separate queue for BIO_META will buy us anything, given that noop is quite often the fastest scheduler for XFS because it enables interleaved metadata I/O to be merged with data I/O. Like I said, I was not able to spend the time to determine exactly how BIO_META affected I/O patterns, so I can't really comment on whether it is really necessary or not.

Quoted 6 lines

There's no seperate queue for meta data IO anywhere. CFQ will give _slight_ preference to meta data IO as a side effect, preferring the meta IO for otherwise same IO in what to serve next in the same queue. And it will not allow preemption of a meta data IO for a data IO.

So using meta should not yield any important boosts by itself.

Quoted 7 lines

Which means that performance increase I saw on CFQ was a result of removing the BIO_SYNC tagging "optimisation" XFS uses for metadata, not from adding BIO_META.....

Could you please document what these tags actually mean and do so that other people don't get as confused as me about this stuff....

Sure, I've added such a patch for 2.6.28.

Signature · 1 line
Jens Axboe