Linux cgroups development
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Tao Cui <cui.tao@linux.dev>
Cc: josef@toxicopanda.com, axboe@kernel.dk, ast@kernel.org,
	alexei.starovoitov@gmail.com, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, andrii@kernel.org, eddyz87@gmail.com,
	daniel@iogearbox.net, linux-kselftest@vger.kernel.org,
	cuitao@kylinos.cn, ameryhung@gmail.com
Subject: Re: [RFC PATCH v14 0/4] blk-iocost: BPF struct_ops cost model
Date: Tue, 01 Dec 2026 05:04:55 -1000	[thread overview]
Message-ID: <b6ddb98c2df4d1987d8c86982950e5df@kernel.org> (raw)
In-Reply-To: <2f386c09-dce8-4d0a-8947-c216738b352c@linux.dev>

Hello, Tao.

On Tue, Dec 01, 2026 at 09:26:21PM +0800, Tao Cui wrote:
> The question is what happens to the per-iocg vtime state on the
> switch. The debt and delays built up under the old model were priced
> with coefficients that don't apply anymore, and paying them back can
> keep the cgroup stalled for a long time. My current branch treats a
> model switch as a fresh start: abs_vdebt and delay are cleared and
> each active iocg's vtime is moved to the activation target budget, the
> same one iocg_activate() gives a newly activated iocg.

Between two working models, I don't think it matters much as what's
carried over is transient. However, a misbehaving BPF model can leave
things in a state which is hard to get out of and switching the model is
how the admin would recover, so being able to reset when switching away
from a BPF model makes sense.

I think the waiters need to be covered too. A bio waiting on iocg->waitq
keeps the cost it was queued with and nothing behind it can go before it
does. Also, the model write freezes the queue, which waits for the
waiters, so AFAICS the switch itself can get stuck behind them. Maybe
something like the following?

1. When switching away from a BPF model, clear ioc->bpf_model and wait
   for an RCU grace period. If the RCU read section in the throttle and
   merge paths covers from calc_vtime_cost() to where the bio is
   committed, charged as debt or put on the waitq, every bio priced by
   the BPF model is accounted for after the grace period.

2. Reset all active iocgs - clear the debts and delays, release all the
   waiters and then move vtime to the activation target as you're doing
   now.

3. Freeze the queue and refresh the params as now.

Thanks.

--
tejun

      reply	other threads:[~2026-12-01 15:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 13:10 [RFC PATCH v14 0/4] blk-iocost: BPF struct_ops cost model Tao Cui
2026-11-18 13:10 ` [RFC PATCH v14 1/4] blk-iocost: add BPF struct_ops cost model support Tao Cui
2026-11-29 19:10   ` Tejun Heo
2026-11-30 10:14     ` Tao Cui
2026-11-18 13:10 ` [RFC PATCH v14 2/4] blk-iocost: add iocost_ioc_tick tracepoint for per-period device summary Tao Cui
2026-11-18 13:49   ` bot+bpf-ci
2026-11-18 13:10 ` [RFC PATCH v14 3/4] selftests/bpf: add iocost cost model test Tao Cui
2026-11-18 13:49   ` bot+bpf-ci
2026-11-18 13:10 ` [RFC PATCH v14 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment Tao Cui
2026-11-18 13:17 ` [RFC PATCH v14 0/4] blk-iocost: BPF struct_ops cost model Tao Cui
2026-11-29  2:17 ` Tao Cui
2026-12-01 13:26 ` Tao Cui
2026-12-01 15:04   ` Tejun Heo [this message]

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=b6ddb98c2df4d1987d8c86982950e5df@kernel.org \
    --to=tj@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bpf@vger.kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=josef@toxicopanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@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
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