From: Ming Lei <ming.lei@redhat.com>
To: Uday Shankar <ushankar@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
Caleb Sander Mateos <csander@purestorage.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v8 1/9] ublk: have a per-io daemon instead of a per-queue daemon
Date: Fri, 30 May 2025 10:05:18 +0800 [thread overview]
Message-ID: <aDkSXliGj_syKKsr@fedora> (raw)
In-Reply-To: <20250529-ublk_task_per_io-v8-1-e9d3b119336a@purestorage.com>
On Thu, May 29, 2025 at 05:47:10PM -0600, Uday Shankar wrote:
> Currently, ublk_drv associates to each hardware queue (hctx) a unique
> task (called the queue's ubq_daemon) which is allowed to issue
> COMMIT_AND_FETCH commands against the hctx. If any other task attempts
> to do so, the command fails immediately with EINVAL. When considered
> together with the block layer architecture, the result is that for each
> CPU C on the system, there is a unique ublk server thread which is
> allowed to handle I/O submitted on CPU C. This can lead to suboptimal
> performance under imbalanced load generation. For an extreme example,
> suppose all the load is generated on CPUs mapping to a single ublk
> server thread. Then that thread may be fully utilized and become the
> bottleneck in the system, while other ublk server threads are totally
> idle.
>
> This issue can also be addressed directly in the ublk server without
> kernel support by having threads dequeue I/Os and pass them around to
> ensure even load. But this solution requires inter-thread communication
> at least twice for each I/O (submission and completion), which is
> generally a bad pattern for performance. The problem gets even worse
> with zero copy, as more inter-thread communication would be required to
> have the buffer register/unregister calls to come from the correct
> thread.
>
> Therefore, address this issue in ublk_drv by allowing each I/O to have
> its own daemon task. Two I/Os in the same queue are now allowed to be
> serviced by different daemon tasks - this was not possible before.
> Imbalanced load can then be balanced across all ublk server threads by
> having the ublk server threads issue FETCH_REQs in a round-robin manner.
> As a small toy example, consider a system with a single ublk device
> having 2 queues, each of depth 4. A ublk server having 4 threads could
> issue its FETCH_REQs against this device as follows (where each entry is
> the qid,tag pair that the FETCH_REQ targets):
>
> ublk server thread: T0 T1 T2 T3
> 0,0 0,1 0,2 0,3
> 1,3 1,0 1,1 1,2
>
> This setup allows for load that is concentrated on one hctx/ublk_queue
> to be spread out across all ublk server threads, alleviating the issue
> described above.
>
> Add the new UBLK_F_PER_IO_DAEMON feature to ublk_drv, which ublk servers
> can use to essentially test for the presence of this change and tailor
> their behavior accordingly.
>
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
next prev parent reply other threads:[~2025-05-30 2:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 23:47 [PATCH v8 0/9] ublk: decouple server threads from ublk_queues/hctxs Uday Shankar
2025-05-29 23:47 ` [PATCH v8 1/9] ublk: have a per-io daemon instead of a per-queue daemon Uday Shankar
2025-05-30 1:33 ` Jens Axboe
2025-05-30 2:05 ` Ming Lei [this message]
2025-05-29 23:47 ` [PATCH v8 2/9] selftests: ublk: kublk: plumb q_id in io_uring user_data Uday Shankar
2025-05-29 23:47 ` [PATCH v8 3/9] selftests: ublk: kublk: tie sqe allocation to io instead of queue Uday Shankar
2025-05-29 23:47 ` [PATCH v8 4/9] selftests: ublk: kublk: lift queue initialization out of thread Uday Shankar
2025-05-29 23:47 ` [PATCH v8 5/9] selftests: ublk: kublk: move per-thread data out of ublk_queue Uday Shankar
2025-05-29 23:47 ` [PATCH v8 6/9] selftests: ublk: kublk: decouple ublk_queues from ublk server threads Uday Shankar
2025-05-29 23:47 ` [PATCH v8 7/9] selftests: ublk: add functional test for per io daemons Uday Shankar
2025-05-29 23:47 ` [PATCH v8 8/9] selftests: ublk: add stress " Uday Shankar
2025-05-30 2:13 ` Ming Lei
2025-05-29 23:47 ` [PATCH v8 9/9] Documentation: ublk: document UBLK_F_PER_IO_DAEMON Uday Shankar
2025-05-30 13:07 ` [PATCH v8 0/9] ublk: decouple server threads from ublk_queues/hctxs 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=aDkSXliGj_syKKsr@fedora \
--to=ming.lei@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=corbet@lwn.net \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=ushankar@purestorage.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.