From: Ming Lei <ming.lei@redhat.com>
To: Nilay Shroff <nilay@linux.ibm.com>
Cc: linux-block@vger.kernel.org, hch@lst.de, axboe@kernel.dk,
sth@linux.ibm.com, gjoyce@ibm.com
Subject: Re: [PATCHv3 1/2] block: move elevator queue allocation logic into blk_mq_init_sched
Date: Fri, 20 Jun 2025 23:17:29 +0800 [thread overview]
Message-ID: <aFV7iSUpCdgqX1Sh@fedora> (raw)
In-Reply-To: <a1644c15-2a9a-4fc1-a762-b153d167cd1f@linux.ibm.com>
On Fri, Jun 20, 2025 at 08:09:01PM +0530, Nilay Shroff wrote:
>
>
> On 6/17/25 8:37 PM, Ming Lei wrote:
> > On Mon, Jun 16, 2025 at 11:02:25PM +0530, Nilay Shroff wrote:
> >> In preparation for allocating sched_tags before freezing the request
> >> queue and acquiring ->elevator_lock, move the elevator queue allocation
> >> logic from the elevator ops ->init_sched callback into blk_mq_init_sched.
> >>
> >> This refactoring provides a centralized location for elevator queue
> >> initialization, which makes it easier to store pre-allocated sched_tags
> >> in the struct elevator_queue during later changes.
> >>
> >> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
> >> ---
>
> [...]
>
> >> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
> >> index 55a0fd105147..d914eb9d61a6 100644
> >> --- a/block/blk-mq-sched.c
> >> +++ b/block/blk-mq-sched.c
> >> @@ -475,6 +475,10 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
> >> q->nr_requests = 2 * min_t(unsigned int, q->tag_set->queue_depth,
> >> BLKDEV_DEFAULT_RQ);
> >>
> >> + eq = elevator_alloc(q, e);
> >> + if (!eq)
> >> + return -ENOMEM;
> >> +
> >> if (blk_mq_is_shared_tags(flags)) {
> >> ret = blk_mq_init_sched_shared_tags(q);
> >> if (ret)
> >
> > The above failure needs to be handled by kobject_put(&eq->kobj).
>
> I think here the elevator_alloc() failure occurs before we initialize
> eq->kobj. So we don't need to handle it with kobject_put(&eq->kobj)
> and instead simply returning -ENOMEM should be sufficient. Agree?
I meant the failure from blk_mq_init_sched_shared_tags(), which has to
call kobject_put() for correct cleanup.
Thanks,
Ming
next prev parent reply other threads:[~2025-06-20 15:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 17:32 [PATCHv3 0/2] block: move sched_tags allocation/de-allocation outside of locking context Nilay Shroff
2025-06-16 17:32 ` [PATCHv3 1/2] block: move elevator queue allocation logic into blk_mq_init_sched Nilay Shroff
2025-06-17 15:07 ` Ming Lei
2025-06-20 14:39 ` Nilay Shroff
2025-06-20 15:17 ` Ming Lei [this message]
2025-06-20 16:13 ` Nilay Shroff
2025-06-23 5:56 ` Christoph Hellwig
2025-06-23 9:14 ` Nilay Shroff
2025-06-16 17:32 ` [PATCHv3 2/2] block: fix lock dependency between percpu alloc lock and elevator lock Nilay Shroff
2025-06-18 3:06 ` Ming Lei
2025-06-18 6:52 ` Nilay Shroff
2025-06-23 6:10 ` Christoph Hellwig
2025-06-23 9:33 ` Nilay Shroff
2025-06-23 13:36 ` Christoph Hellwig
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=aFV7iSUpCdgqX1Sh@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=gjoyce@ibm.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=sth@linux.ibm.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 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.