Skip to contentSkip to conversation

linux-next: manual merge of the block tree with Linus' tree

DISCUSSION Stephen Rothwell 2 participants 7 messages Jun 23, 2017 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi Jens,

Today's linux-next merge of the block tree got a conflict in:

block/blk-mq-sched.c

between commit:

8e8320c9315c ("blk-mq: fix performance regression with shared tags")

from Linus' tree and commits:

d2c0d3832469 ("blk-mq: move blk_mq_sched_{get,put}_request to blk-mq.c") 44e8c2bff80b ("blk-mq: refactor blk_mq_sched_assign_ioc")

from the block tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 140 lines
Cheers,
Stephen Rothwell

diff --cc block/blk-mq-sched.c
index 0ded5e846335,191bf82d185e..000000000000
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@@ -47,131 -46,10 +46,49 @@@ void blk_mq_sched_assign_ioc(struct req
  		if (!icq)
  			return;
  	}
- 
+ 	get_io_context(icq->ioc);
  	rq->elv.icq = icq;
- 	if (!blk_mq_sched_get_rq_priv(q, rq, bio)) {
- 		rq->rq_flags |= RQF_ELVPRIV;
- 		get_io_context(icq->ioc);
- 		return;
- 	}
- 
- 	rq->elv.icq = NULL;
- }
- 
- static void blk_mq_sched_assign_ioc(struct request_queue *q,
- 				    struct request *rq, struct bio *bio)
- {
- 	struct io_context *ioc;
- 
- 	ioc = rq_ioc(bio);
- 	if (ioc)
- 		__blk_mq_sched_assign_ioc(q, rq, bio, ioc);
  }
  
 +/*
 + * Mark a hardware queue as needing a restart. For shared queues, maintain
 + * a count of how many hardware queues are marked for restart.
 + */
 +static void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx)
 +{
 +	if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
 +		return;
 +
 +	if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
 +		struct request_queue *q = hctx->queue;
 +
 +		if (!test_and_set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
 +			atomic_inc(&q->shared_hctx_restart);
 +	} else
 +		set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
 +}
 +
 +static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx)
 +{
 +	if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
 +		return false;
 +
 +	if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
 +		struct request_queue *q = hctx->queue;
 +
 +		if (test_and_clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
 +			atomic_dec(&q->shared_hctx_restart);
 +	} else
 +		clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
 +
 +	if (blk_mq_hctx_has_pending(hctx)) {
 +		blk_mq_run_hw_queue(hctx, true);
 +		return true;
 +	}
 +
 +	return false;
 +}
 +
- struct request *blk_mq_sched_get_request(struct request_queue *q,
- 					 struct bio *bio,
- 					 unsigned int op,
- 					 struct blk_mq_alloc_data *data)
- {
- 	struct elevator_queue *e = q->elevator;
- 	struct request *rq;
- 
- 	blk_queue_enter_live(q);
- 	data->q = q;
- 	if (likely(!data->ctx))
- 		data->ctx = blk_mq_get_ctx(q);
- 	if (likely(!data->hctx))
- 		data->hctx = blk_mq_map_queue(q, data->ctx->cpu);
- 
- 	if (e) {
- 		data->flags |= BLK_MQ_REQ_INTERNAL;
- 
- 		/*
- 		 * Flush requests are special and go directly to the
- 		 * dispatch list.
- 		 */
- 		if (!op_is_flush(op) && e->type->ops.mq.get_request) {
- 			rq = e->type->ops.mq.get_request(q, op, data);
- 			if (rq)
- 				rq->rq_flags |= RQF_QUEUED;
- 		} else
- 			rq = __blk_mq_alloc_request(data, op);
- 	} else {
- 		rq = __blk_mq_alloc_request(data, op);
- 	}
- 
- 	if (rq) {
- 		if (!op_is_flush(op)) {
- 			rq->elv.icq = NULL;
- 			if (e && e->type->icq_cache)
- 				blk_mq_sched_assign_ioc(q, rq, bio);
- 		}
- 		data->hctx->queued++;
- 		return rq;
- 	}
- 
- 	blk_queue_exit(q);
- 	return NULL;
- }
- 
- void blk_mq_sched_put_request(struct request *rq)
- {
- 	struct request_queue *q = rq->q;
- 	struct elevator_queue *e = q->elevator;
- 
- 	if (rq->rq_flags & RQF_ELVPRIV) {
- 		blk_mq_sched_put_rq_priv(rq->q, rq);
- 		if (rq->elv.icq) {
- 			put_io_context(rq->elv.icq->ioc);
- 			rq->elv.icq = NULL;
- 		}
- 	}
- 
- 	if ((rq->rq_flags & RQF_QUEUED) && e && e->type->ops.mq.put_request)
- 		e->type->ops.mq.put_request(rq);
- 	else
- 		blk_mq_finish_request(rq);
- }
- 
  void blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx)
  {
  	struct request_queue *q = hctx->queue;
#1 lore raw
Quoted 15 lines · Stephen Rothwell

Hi Jens,

Today's linux-next merge of the block tree got a conflict in:

block/blk-mq-sched.c

between commit:

8e8320c9315c ("blk-mq: fix performance regression with shared tags")

from Linus' tree and commits:

d2c0d3832469 ("blk-mq: move blk_mq_sched_{get,put}_request to blk-mq.c") 44e8c2bff80b ("blk-mq: refactor blk_mq_sched_assign_ioc")

Quoted 8 lines

from the block tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

I'll cherry pick that commit into the 4.13 branch to get this resolved.

Signature · 1 line
Jens Axboe
#2 lore raw

Hi Jens,

Quoted 2 lines · On Thu, 22 Jun 2017 21:09:22 -0600 Jens Axboe <[email protected]> wrote:

I'll cherry pick that commit into the 4.13 branch to get this resolved.

Merging commit 8e8320c9315c might give a better result ...

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 7 lines · Stephen Rothwell

Hi Jens,

Quoted 2 lines · On Thu, 22 Jun 2017 21:09:22 -0600 Jens Axboe <[email protected]> wrote:

I'll cherry pick that commit into the 4.13 branch to get this resolved.

Merging commit 8e8320c9315c might give a better result ...

I don't want to pull the whole thing in, just that offending commit.

Signature · 1 line
Jens Axboe
#6 lore raw
In reply to Stephen Rothwell
Quoted 7 lines · Stephen Rothwell

Hi Jens,

Quoted 2 lines · On Thu, 22 Jun 2017 21:09:22 -0600 Jens Axboe <[email protected]> wrote:

I'll cherry pick that commit into the 4.13 branch to get this resolved.

Merging commit 8e8320c9315c might give a better result ...

To be clear, what I meant (and did) was cherry picking 8e8320c9315c into for-4.13/block.

Signature · 1 line
Jens Axboe
#4 lore raw
In reply to Jens Axboe

Hi Jens,

Quoted 11 lines · On Thu, 22 Jun 2017 21:27:04 -0600 Jens Axboe <[email protected]> wrote:
Quoted 7 lines · Stephen Rothwell

Hi Jens,

Quoted 2 lines · On Thu, 22 Jun 2017 21:09:22 -0600 Jens Axboe <[email protected]> wrote:

I'll cherry pick that commit into the 4.13 branch to get this resolved.

Merging commit 8e8320c9315c might give a better result ...

I don't want to pull the whole thing in, just that offending commit.

Your tree is already based on v4.12-rc5 so you are not really pulling much in at all:

$ git rev-list --count --no-merges 8e8320c9315c ^block/for-next 
14
Signature · 2 lines
Cheers,
Stephen Rothwell
#5 lore raw
Quoted 13 lines · Stephen Rothwell

Hi Jens,

Quoted 10 lines · On Thu, 22 Jun 2017 21:27:04 -0600 Jens Axboe <[email protected]> wrote:
Quoted 7 lines · Stephen Rothwell

Hi Jens,

Quoted 2 lines · On Thu, 22 Jun 2017 21:09:22 -0600 Jens Axboe <[email protected]> wrote:

I'll cherry pick that commit into the 4.13 branch to get this resolved.

Merging commit 8e8320c9315c might give a better result ...

Quoted 7 lines
Quoted 1 line

I don't want to pull the whole thing in, just that offending commit.

Your tree is already based on v4.12-rc5 so you are not really pulling much in at all:

$ git rev-list --count --no-merges 8e8320c9315c ^block/for-next 
14

Yeah good point, I guess not a lot has happened since -rc5.

Signature · 1 line
Jens Axboe