mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Tao Cui <cui.tao@linux.dev>
Cc: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
	yukuai@fygo.io, linux-block@vger.kernel.org,
	linux-nvme@lists.infradead.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, cuitao@kylinos.cn
Subject: Re: [RFC PATCH 1/1] block: charge passthrough requests to the submitter's cgroup
Date: Mon, 21 Sep 2026 06:51:26 -1000	[thread overview]
Message-ID: <arFgjkKUwYGWbV8H@slm.duckdns.org> (raw)
In-Reply-To: <20260921070647.1928289-2-cui.tao@linux.dev>

On Mon, Sep 21, 2026 at 03:06:47PM +0800, Tao Cui wrote:
> From: Tao Cui <cuitao@kylinos.cn>
> 
> Passthrough requests (SG_IO, bsg, nvme passthrough ioctls and uring
> commands) are dispatched via blk_execute_rq{,_nowait}() without ever
> passing through submit_bio(), so the bio mapped by blk_rq_map_user()
> carries no blkcg association: the transferred bytes never show up in
> cgroup io.stat, and every rq_qos policy on the queue (iocost,
> iolatency, wbt) is bypassed, as is blk-throttle, which hooks
> submit_bio_noacct() directly rather than going through rq_qos.
> 
> A quick demonstration on a scsi_debug device with iocost enabled and
> vrate pinned to its 1% floor: a direct fio writer was throttled ~10x
> while the same cgroup issuing sg_dd writes ran at full device speed
> with zero io.stat accounting.
> 
> Associate the mapped bio with the submitter's blkcg at dispatch time
> and run the regular bio accounting (blk_cgroup_bio_start()) and
> rq_qos throttle paths with it.  DRV_IN/DRV_OUT commands are mapped to
> READ/WRITE so io.stat classifies their bytes normally; request
> completion already pairs with the throttle through bio_endio() ->
> rq_qos_done_bio().
> 
> The charge is gated by opcode (READ/WRITE/DRV_IN/DRV_OUT) and to
> queues that already have a gendisk: commands issued during device
> probing (SCSI INQUIRY etc.) have no gendisk yet and stay exempt,
> following the same probe-exemption reasoning as the passthrough
> iostats support.

Do you have an actual use case where this matters?

Thanks.

-- 
tejun

  reply	other threads:[~2026-09-21 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  7:06 [RFC PATCH 0/1] " Tao Cui
2026-09-21  7:06 ` [RFC PATCH 1/1] " Tao Cui
2026-09-21 16:51   ` Tejun Heo [this message]
2026-09-22  8:09     ` Tao Cui
2026-09-21  7:27 ` [RFC PATCH 0/1] " Tao Cui

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=arFgjkKUwYGWbV8H@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=yukuai@fygo.io \
    /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

all inboxes | Powered by JetHome®