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=1796058017; b=XW3QqV8e+dfCX5IyxguFz+6szTi/DcH/lxOoQDGyxkkriuOUVaqfmRFvrYV6/EgzioyK JANYwN0StDoFqUBOGcH/oeE6dyWXYn/uCduL2yu1mf9L6xBKlQeaoF7e1+DakfGmuZ0Ut Q7uKPLrY08tlL02YrfVCEIqB+aEFZA/4wD9hz98mol3O/0K7mygj90aYtCCb53wfjbIG/ 4qKsWx2un/PvsjjCIoO90itaMXqSv2rx1+3J9pcTa4oxazwQT6CrkFU3I46RNztwEw9nC 4YmVzZX/AeLpTchaIm47pVG02PhE+2Wxoorl+GeZaiz7FvQ7lMzR1ywh1Fn5C2UeQbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796058017; h=Received:DKIM-Signature:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=dRhgB4AHOY9xw4h14FLLfK82Qy3R7EZcuPjEmPHjiE4=; b=F42IGQKpzbH0JuHLkSuhlax8myFRO/IR6E3QD/OhtWu87W7UWHemrTT8UItQzphHSiDH 7HzGxhaEqoQZV+NfWQYZmgybDrInraVuCl51uaeCto/xpHKX15ffVlJn3w7G27dUa2lbS 94e+pnz8UXwRALo5u6SzVOyt8zRj/u7o6zAR17YzwOlryl4Eq0LJ3Gexi7uHouvJQO7T+ 7qkq55u6k7IAtTbSdCM2veE2ZbiW0gZZIt59SdhxnzScOnPjZ137CCR2q9B0RA3dR4UNV 4R+6ZwlyhIL2VdrSPFatdFI/SXc20SSFMEKALGguVFznxfj9yVz/PN2bu43u+pjRxWQ== 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="MWvPUj/O"; 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 4FC14606A327; Mon, 30 Nov 2026 17:00:17 +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=MWvPUj/O Received: by smtp.kernel.org (Postfix) with ESMTPSA id A72EA1F0092F; Mon, 30 Nov 2026 17:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796058016; bh=dRhgB4AHOY9xw4h14FLLfK82Qy3R7EZcuPjEmPHjiE4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=MWvPUj/OBt6nvdvwhJO/swaF+ozk9/ufbRxJW3f8YC2l5EvriYn48Ao6bv+9mg331 rtNF6qKwnV55ZOULQiQ/XxMepnf7tIiq0L7obeCJ54qdh0iBSg9HKBIm+lng2IKwAe Pebnr1NPbxkeZLNqOi1f1S6HPqr98aqa/yLcfXnZdVd761EJOZZ6obyaGXW34KV2wj KxISdE3ZC4zfV+liNiLWvD41ZbbABbsP9PjSGO/QqOUapiVL53Wn7pQ2uez+sda2Ae CALRQhInldFNl8kyo7hnxleqmjkonJ0WtUYiHxTUj/VgtOmV5n25K6gJw/Lc+Zvq8P 3agONB0ZlYE2Q== Date: Mon, 30 Nov 2026 07:00:16 -1000 Message-ID: <442deed128ab064df56fd74a4100b8f5@kernel.org> From: Tejun Heo To: Gui-Dong Han Cc: Josef Bacik , Jens Axboe , cgroups@vger.kernel.org, linux-block@vger.kernel.org, Jia-Ju Bai Subject: Re: [PATCH] blk-cgroup: publish delay before enabling throttling In-Reply-To: <20261130133403.3789095-1-hanguidong02@gmail.com> References: <20261130133403.3789095-1-hanguidong02@gmail.com> 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, Gui-Dong. On Mon, Nov 30, 2026 at 09:34:03PM +0800, Gui-Dong Han wrote: > blkcg_set_delay() sets blkg->use_delay to -1 before storing > blkg->delay_nsec, so another CPU can see throttling enabled with a zero > or stale delay: ... > Store delay_nsec before enabling use_delay, and pair > atomic_try_cmpxchg() with atomic_read_acquire(&blkg->use_delay) in > blkcg_maybe_throttle_blkg() so the delay_nsec load is ordered after the > use_delay check. The race window is tiny and the effect is transient. AFAICS, the worst that can happen is a task skipping one throttle or sleeping once on the previous delay, and the delay mechanism is approximate to begin with. I don't think this matters in practice and wouldn't call the current code broken. Maybe this just needs a comment noting that the reader can see use_delay and delay_nsec out of sync and that it's harmless? Thanks. -- tejun