md: Change active_io to percpu
authorXiao Ni <xni@redhat.com>
Tue, 31 Jan 2023 05:17:10 +0000 (13:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:41 +0000 (09:42 +0200)
commit835cbfebc1c54c0e8a1ffedaf48381178d390135
treeb683dbcc68ab686c1bd02fb55c150f93b7d446ec
parent3db392257008860fd6f9c22e083b2b789eec3f0c
md: Change active_io to percpu

[ Upstream commit 72adae23a72cb12e2ef0dcd7c0aa042867f27998 ]

Now the type of active_io is atomic. It's used to count how many ios are
in the submitting process and it's added and decreased very time. But it
only needs to check if it's zero when suspending the raid. So we can
switch atomic to percpu to improve the performance.

After switching active_io to percpu type, we use the state of active_io
to judge if the raid device is suspended. And we don't need to wake up
->sb_wait in md_handle_request anymore. It's done in the callback function
which is registered when initing active_io. The argument mddev->suspended
is only used to count how many users are trying to set raid to suspend
state.

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Song Liu <song@kernel.org>
Stable-dep-of: e24ed04389f9 ("md: restore 'noio_flag' for the last mddev_resume()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/md.c
drivers/md/md.h