Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: buffered io_uring vs task io accounting
Date: Fri, 13 Sep 2019 16:41:08 -0700
Message-ID: <20190913234108.gdux4v5xqckohfru@alap3.anarazel.de> (raw)

Hi,

It appears that task io accounting doesn't currently work when io_uring
defers work to workqueues.

E.g. while I get system wide "iostats -xm 1 /dev/sda" stats like:

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
sda              0.00 36475.00      0.00    250.52     0.00   660.00   0.00   1.78    0.00    0.14   0.00     0.00     7.03   0.03  99.70

"pidstat -d 1" as the user execution fio just shows

03:15:37 PM   UID       PID   kB_rd/s   kB_wr/s kB_ccwr/s iodelay  Command
03:15:38 PM     0     13626     -1.00     -1.00     -1.00      53  kworker/u16:2-io_ring-wq
03:15:38 PM     0     13734     -1.00     -1.00     -1.00      51  kworker/u16:3+io_ring-write-wq
03:15:38 PM     0     13735     -1.00     -1.00     -1.00      53  kworker/u16:4+io_ring-wq
03:15:38 PM     0     13736     -1.00     -1.00     -1.00      50  kworker/u16:5-io_ring-wq
03:15:38 PM     0     13766     -1.00     -1.00     -1.00      52  kworker/u16:7-io_ring-wq
03:15:38 PM     0     13767     -1.00     -1.00     -1.00      51  kworker/u16:8-io_ring-write-wq
03:15:38 PM     0     13769     -1.00     -1.00     -1.00      51  kworker/u16:10+io_ring-wq

and as root I get:

03:20:05 PM   UID       PID   kB_rd/s   kB_wr/s kB_ccwr/s iodelay  Command
03:20:06 PM     0     13735      0.00  34344.00      0.00      49  kworker/u16:4+io_ring-wq
03:20:06 PM     0     13736      0.00  36080.00      0.00      47  kworker/u16:5+io_ring-wq
03:20:06 PM     0     13737      0.00  36624.00      0.00      43  kworker/u16:6+io_ring-wq
03:20:06 PM     0     13766      0.00  30616.00      0.00      50  kworker/u16:7+io_ring-wq
03:20:06 PM     0     13768      0.00  38728.00      0.00      47  kworker/u16:9+io_ring-wq
03:20:06 PM     0     13769      0.00  37792.00      0.00      51  kworker/u16:10+io_ring-wq
03:20:06 PM     0     13890      0.00  39176.00      0.00      47  kworker/u16:13+io_ring-wq

and nothing is attributed to fio itself.  For DIO I do get working task
stats however.

That is not all that surprising because tasks deferred to the workqueue
won't properly be accounted for, because the page is dirtied from within
the workqueue, rather than the normal process context.


I suspect this doesn't just affect task io stats, but also means that
io_uring writes will be able to escape writeback throttling, because
presumably the workqueue kthreads are going to be throttled as
individual tasks, rather than using causing the issuing process to be
throttled.

I assume this is a problem that needs to be fixed?

Greetings,

Andres Freund

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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=20190913234108.gdux4v5xqckohfru@alap3.anarazel.de \
    --to=andres@anarazel.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /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

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox