From: Nilay Shroff <nilay@linux.ibm.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, hch@lst.de, axboe@kernel.dk,
sth@linux.ibm.com, gjoyce@ibm.com
Subject: Re: [PATCH] block: fix lock dependency between percpu alloc lock and elevator lock
Date: Wed, 21 May 2025 13:10:33 +0530 [thread overview]
Message-ID: <fc27de62-10a7-450b-a733-c9546948fcbe@linux.ibm.com> (raw)
In-Reply-To: <aC1Ropdb5x05WCIc@fedora>
On 5/21/25 9:38 AM, Ming Lei wrote:
> Hi Nilay,
>
> On Tue, May 20, 2025 at 04:03:49PM +0530, Nilay Shroff wrote:
>
> Not dig into this implementation, will look into later.
>
> I guess it should work by extending elv_change_ctx.
>
> However we have other elevator_queue lifetime issue, that is why
> ->elevator_lock is used almost everywhere.
>
> Another solution is to move all `sched_data` into 'struct elevator_queue':
>
> I feel it may be simpler in concept:
>
> - sched data and elevator queue share same lifetime
>
> - kobject_put(&eq->kobj) is already called without holding ->elevator_lock &
> queue isn't freezed
>
> - replace unnecessary ->elevator_lock by blk_get_elevator()/blk_put_elevator()
>
> But it needs some cleanup/refactor on scheduler interface.
>
> What do you think about the above way?
IMO moving scheduler specific data/tags into 'struct elevator_queue' is
a good idea. So instead of extending elv_change_ctx for storing/restoring
sched_tags (which this propose patch implements), we may now store the
sched_tags inside elevator_queue. And as you mentioned, the lifetime of
elevator_queue and sched_tags are similar, we can release the sched_tags
along with releasing the elevator kobject (which anyways happens outside
of ->elevator_lock and ->freeze_lock). Also elevator queue alloc code
can be moved out of init_sched before we acquire ->elevator_lock and
->freeze_lock. And, as Christoph mentioned in another email, the changes
might be invasive but it seems doable.
I will send another patch with the above changes.
Thanks,
--Nilay
next prev parent reply other threads:[~2025-05-21 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 10:33 [PATCH] block: fix lock dependency between percpu alloc lock and elevator lock Nilay Shroff
2025-05-21 4:08 ` Ming Lei
2025-05-21 6:03 ` Christoph Hellwig
2025-05-21 7:40 ` Nilay Shroff [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-05-21 3:34 kernel test robot
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=fc27de62-10a7-450b-a733-c9546948fcbe@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@kernel.dk \
--cc=gjoyce@ibm.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.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.