From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796137496; b=L4ZGLi2RjE0t4dkm47Lj8bA72eiu7pKGDSh/hhuPGNZtlkY8jyNiGuh7FkJOVE3XtNiY /1uxLusPazPgTb0wheGufku2szbEPZZWItEi3N3aurDUt26JOs98B4TT3zdlpHhnaSn+D vDxXsaikpGlA1DATy+aq/c+rNKVKj0YbLtcqFuh0U5kVs5TaEMdVW9e+9LtcmEZeaJF8r O0CvEUPltBsyuHe6W2no5GUVvaAyIhSQGQGaECPV/oP3AuuTVYmnftoZ+4HI+FSrFUbuF bucdzReUysXvaK4LV3L9cPGS6Udqax0WgSrGMnt14t9x6iJ2wvM7OuJuSy0f7SnEbsw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796137496; h=Received:DKIM-Signature:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=zxCqkJRQ+M4FGw9nnP7xHyJzdH7Ef73MZv43wdwleW8=; b=LR8EIc1NI007jLJ2e7HNZW/gOGMG0sb4SU8BABvs86v1jrsPDxLdQ67oHAdfja92dyed t7W62VGeqRLFvA0QsTgmS7RiJvoBhMB/OlWgDbJ92KsSmuO6V1Y7D1jbWk1eulk4e1xvt sKHkW5Rv9FOx2L/P5nqzSZWeOroMhEAfihpgzmvDwGlV8Zj7Fm2VUPUwqWgaVkIO9g6Pe PgJhL2qnOupwYnd9PSF6XMOlk47GidYQduQCc9swXJTU27JXpI5AL9UzfHY3Bo8Oa/KT3 f9Od0wXTsyMcr+hfPr8gQqOHFvBWMKhoGpMZYhzjjSbJZ9SNpnPqmD1xk/hLM2U+gJA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DLxF7Dv2; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A6D2606A32E; Tue, 1 Dec 2026 15:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DLxF7Dv2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D757D1F000C1; Tue, 1 Dec 2026 15:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796137496; bh=zxCqkJRQ+M4FGw9nnP7xHyJzdH7Ef73MZv43wdwleW8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=DLxF7Dv2PduhT5xwJlGE+inPT6KJ0/83U6iff0mZz9djPYlpOkSg0YeWeprIXweCH SxPy0i9EIIyMJTOZCk9p1RKLnLkMhSydOHkfYh2d3ml/2F6CXZpg05KNkKfN7VFO8w arP+1YbB9OWbgbuQR5yHIEgDwN/pgNMxsBBQjoGc8FDxvgZLZMY83UK4VkrbpZUfLn efPR5cvlPV6PYXnB9rXxaUvD/ToYzmI8s+6LQDJGDzNp/iATXDXYDI9l4LRHuIVJJw Fmk2g1dudBZhvryXiiLwXIttgSlurXUWgOGr+weUimudA1bnWKI2Oe19O4sm1+VvM5 xByEAQvmvvsyA== Date: Tue, 01 Dec 2026 05:04:55 -1000 Message-ID: From: Tejun Heo To: Tao Cui 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 In-Reply-To: <2f386c09-dce8-4d0a-8947-c216738b352c@linux.dev> References: <20261118131029.797007-1-cui.tao@linux.dev> <2f386c09-dce8-4d0a-8947-c216738b352c@linux.dev> X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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