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,
yi.zhang@redhat.com, czhong@redhat.com, yukuai@fnnas.com,
gjoyce@ibm.com
Subject: Re: [PATCHv4 5/5] block: define alloc_sched_data and free_sched_data methods for kyber
Date: Tue, 11 Nov 2025 11:01:14 +0800 [thread overview]
Message-ID: <aRKm-qGucFuHoGtE@fedora> (raw)
In-Reply-To: <20251110081457.1006206-6-nilay@linux.ibm.com>
On Mon, Nov 10, 2025 at 01:44:52PM +0530, Nilay Shroff wrote:
> Currently, the Kyber elevator allocates its private data dynamically in
> ->init_sched and frees it in ->exit_sched. However, since ->init_sched
> is invoked during elevator switch after acquiring both ->freeze_lock and
> ->elevator_lock, it may trigger the lockdep splat [1] due to dependency
> on pcpu_alloc_mutex.
>
> To resolve this, move the elevator data allocation and deallocation
> logic from ->init_sched and ->exit_sched into the newly introduced
> ->alloc_sched_data and ->free_sched_data methods. These callbacks are
> invoked before acquiring ->freeze_lock and ->elevator_lock, ensuring
> that memory allocation happens safely without introducing additional
> locking dependencies.
>
> This change breaks the dependency chain involving pcpu_alloc_mutex and
> prevents the reported lockdep warning.
>
> [1] https://lore.kernel.org/all/CAGVVp+VNW4M-5DZMNoADp6o2VKFhi7KxWpTDkcnVyjO0=-D5+A@mail.gmail.com/
>
> Reported-by: Changhui Zhong <czhong@redhat.com>
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Closes: https://lore.kernel.org/all/CAGVVp+VNW4M-5DZMNoADp6o2VKFhi7KxWpTDkcnVyjO0=-D5+A@mail.gmail.com/
> Tested-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
prev parent reply other threads:[~2025-11-11 3:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 8:14 [PATCHv4 0/5] block: restructure elevator switch path and fix a lockdep splat Nilay Shroff
2025-11-10 8:14 ` [PATCHv4 1/5] block: unify elevator tags and type xarrays into struct elv_change_ctx Nilay Shroff
2025-11-11 6:55 ` Yu Kuai
2025-11-11 8:37 ` Nilay Shroff
2025-11-11 10:02 ` Yu Kuai
2025-11-11 12:00 ` Nilay Shroff
2025-11-10 8:14 ` [PATCHv4 2/5] block: move elevator tags into struct elevator_resources Nilay Shroff
2025-11-11 2:52 ` Ming Lei
2025-11-11 6:49 ` Nilay Shroff
2025-11-10 8:14 ` [PATCHv4 3/5] block: introduce alloc_sched_data and free_sched_data elevator methods Nilay Shroff
2025-11-11 2:53 ` Ming Lei
2025-11-11 7:20 ` Yu Kuai
2025-11-11 8:39 ` Nilay Shroff
2025-11-10 8:14 ` [PATCHv4 4/5] block: use {alloc|free}_sched data methods Nilay Shroff
2025-11-11 2:58 ` Ming Lei
2025-11-11 6:51 ` Nilay Shroff
2025-11-10 8:14 ` [PATCHv4 5/5] block: define alloc_sched_data and free_sched_data methods for kyber Nilay Shroff
2025-11-11 3:01 ` Ming Lei [this message]
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=aRKm-qGucFuHoGtE@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=czhong@redhat.com \
--cc=gjoyce@ibm.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=yi.zhang@redhat.com \
--cc=yukuai@fnnas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).