All of lore.kernel.org
 help / color / mirror / Atom feed
* Two points of confusion on offloading and workqueue.c
@ 2022-02-11  4:34 Nick Neumann
  2022-02-15 18:07 ` Nick Neumann
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Neumann @ 2022-02-11  4:34 UTC (permalink / raw)
  To: fio

I'm trying to fix a couple bugs I've talked about in a previous post
related to offloading, and in diving into workload.c I've hit some
things that have me confused. If someone understands the code well and
can give some pointers I'd be very grateful.

First, is the reading of sw->flags in __get_submit_worker
intentionally not protected by the sw->lock? I'm guessing so, with the
intention that the worst that happens is a submit worker is seen as
busy when it is actually idle.

But this approach confuses me for a couple reasons. First, the
td->io_u_freelist seems to have the same sort of thread contention
issues when doing offloading. The main td thread is removing things
from the freelist while any worker thread can insert into the
freelist, so they all coordinate with the td->io_u_lock. Why not just
use the same approach for maintaining the list of free submit workers?

My second bit of confusion is that the number of io_u's allocated is
exactly iodepth. That's also the number of submit workers allocated by
the workqueue when offloading. Unless I'm mistaken (that's totally
possible), a free io_u will be obtained by get_io_u, will be handed
off to a submit worker, and when done, will become free again and the
submit worker will become idle. So aren't there enough submit workers
that there should always be one idle for any io_u that needs one?

Thanks in advance for your help.
- Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Two points of confusion on offloading and workqueue.c
  2022-02-11  4:34 Two points of confusion on offloading and workqueue.c Nick Neumann
@ 2022-02-15 18:07 ` Nick Neumann
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Neumann @ 2022-02-15 18:07 UTC (permalink / raw)
  To: fio; +Cc: axboe

On Thu, Feb 10, 2022 at 10:34 PM Nick Neumann <nick@pcpartpicker.com> wrote:
>
> I'm trying to fix a couple bugs I've talked about in a previous post
> related to offloading, and in diving into workload.c I've hit some
> things that have me confused. If someone understands the code well and
> can give some pointers I'd be very grateful.
>
> First, is the reading of sw->flags in __get_submit_worker
> intentionally not protected by the sw->lock? I'm guessing so, with the
> intention that the worst that happens is a submit worker is seen as
> busy when it is actually idle.
>
> But this approach confuses me for a couple reasons. First, the
> td->io_u_freelist seems to have the same sort of thread contention
> issues when doing offloading. The main td thread is removing things
> from the freelist while any worker thread can insert into the
> freelist, so they all coordinate with the td->io_u_lock. Why not just
> use the same approach for maintaining the list of free submit workers?
>
> My second bit of confusion is that the number of io_u's allocated is
> exactly iodepth. That's also the number of submit workers allocated by
> the workqueue when offloading. Unless I'm mistaken (that's totally
> possible), a free io_u will be obtained by get_io_u, will be handed
> off to a submit worker, and when done, will become free again and the
> submit worker will become idle. So aren't there enough submit workers
> that there should always be one idle for any io_u that needs one?
>
> Thanks in advance for your help.
> - Nick

cc'ing Jens in case this is something he might have some thoughts on

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-15 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11  4:34 Two points of confusion on offloading and workqueue.c Nick Neumann
2022-02-15 18:07 ` Nick Neumann

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.