All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 1/3] block: move io_context creation into where it's needed
Date: Tue, 23 Nov 2021 09:53:58 -0700	[thread overview]
Message-ID: <a2b73453-c38c-c951-58cf-b8b3ee3fefb7@kernel.dk> (raw)
In-Reply-To: <56538fd1-ca28-386b-36ba-493399af1803@kernel.dk>

On 11/23/21 9:46 AM, Jens Axboe wrote:
> On 11/23/21 9:39 AM, Christoph Hellwig wrote:
>>> +	/* create task io_context, if we don't have one already */
>>> +	if (unlikely(!current->io_context))
>>> +		create_task_io_context(current, GFP_ATOMIC, rq->q->node);
>>
>> Wouldn't it be nicer to have an interface that hides the check
>> and the somewhat pointless current argument?  And name that with a
>> blk_ prefix?
> 
> Yeah, we can do that.
> 
>>> +
>>> +	blk_mq_sched_assign_ioc(rq);
>>
>> But thinking about this a little more:
>>
>> struct io_context has two uses, one is the unsigned short ioprio,
>> and the other is the whole bfq mess.
>>
>> Can't we just split the ioprio out (we'll find a hole somewhere
>> in task_struct) and then just allocate the io_context in
>> blk_mq_sched_assign_ioc, which would also avoid the pointless
>> ioc_lookup_icq on a newly allocated io_context.  I'd also really
>> expect blk_mq_sched_assign_ioc to be implemented in blk-ioc.c.
> 
> It would be nice to decouple ioprio from the io_context, and just
> leave the io_context for BFQ essentially.
> 
> I'll give it a shot.

Actually may not be that trivial - if a thread is cloned with CLONE_IO,
then it shares the io_context, and hence also the io priority. That will
auto-propagate if one linked task changes it, and putting it in the
task_struct would break that.

So I don't think we can do that - which is a shame, as it would be a
nice cleanup.

-- 
Jens Axboe


  reply	other threads:[~2021-11-23 16:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 16:18 [PATCHSET 0/3] Misc block cleanups Jens Axboe
2021-11-23 16:18 ` [PATCH 1/3] block: move io_context creation into where it's needed Jens Axboe
2021-11-23 16:39   ` Christoph Hellwig
2021-11-23 16:46     ` Jens Axboe
2021-11-23 16:53       ` Jens Axboe [this message]
2021-11-23 16:56         ` Christoph Hellwig
2021-11-23 17:04           ` Jens Axboe
2021-11-23 16:18 ` [PATCH 2/3] blk-ioprio: don't set bio priority if not needed Jens Axboe
2021-11-23 16:18 ` [PATCH 3/3] block: only allocate poll_stats if there's a user of them Jens Axboe
2021-11-23 16:21   ` Johannes Thumshirn
2021-11-23 16:27     ` Jens Axboe
2021-11-23 16:41   ` Christoph Hellwig
2021-11-23 16:44     ` Jens Axboe
2021-11-23 17:05       ` Christoph Hellwig
2021-11-23 17:06         ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2021-11-23 17:10 [PATCHSET 0/3 v2] Misc block cleanups Jens Axboe
2021-11-23 17:10 ` [PATCH 1/3] block: move io_context creation into where it's needed Jens Axboe
2021-11-23 18:46   ` Christoph Hellwig
2021-11-23 18:58     ` Jens Axboe

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=a2b73453-c38c-c951-58cf-b8b3ee3fefb7@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.