Re: [GIT PULL] Networking for v6.9

From: Tejun Heo
Date: Tue Mar 12 2024 - 18:14:44 EST


Hello,

On Tue, Mar 12, 2024 at 04:02:08PM -0600, Jens Axboe wrote:
> diff --git a/block/blk.h b/block/blk.h
> index a19b7b42e650..5cac4e29ae17 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -534,7 +534,7 @@ static inline u64 blk_time_get_ns(void)
> {
> struct blk_plug *plug = current->plug;
>
> - if (!plug)
> + if (!plug || !in_task())
> return ktime_get_ns();

Late to the party but I think the following is what iocost is doing:

1. A cgroup overspends and needs to wait before issuing further IOs. It
takes the current time, add the duratoin that it'd need to wait to issue
further IOs and then schedules the hrtimer.

2. The timer triggers and runs iocg_waitq_timer_fn() which takes the current
time and calculates its current budget (which gets replenished as time
passes). If the pending IOs fit in the current budget, it issues them. If
there are still pending IOs, it calculates the next timer wakeup point as
the read current time + the time needed to resume IO processing.

3. If the read current time is sufficiently in the past, the hrtimer
scheduled in #2 would expire immediately and if it still reads the same
cached current time, the calculated budget would be zero. It won't be
able to issue any more IOs and will schedule the hrtimer on the same
exact expire time as before, falling into an infinite loop.

So, whatever that can feed actual time to iocg_wait_timer_fn() should fix
the issue.

Thanks.

--
tejun