Commit c5a6561b authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

iocost: add iocg_forgive_debt tracepoint



Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c7af2a00
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2046,12 +2046,24 @@ static void ioc_forgive_debts(struct ioc *ioc, u64 usage_us_sum, int nr_debtors,
	ioc->dfgv_period_rem = do_div(nr_cycles, DFGV_PERIOD);

	list_for_each_entry(iocg, &ioc->active_iocgs, active_list) {
		u64 __maybe_unused old_debt, __maybe_unused old_delay;

		if (!iocg->abs_vdebt)
			continue;

		spin_lock(&iocg->waitq.lock);

		old_debt = iocg->abs_vdebt;
		old_delay = iocg->delay;

		iocg->abs_vdebt >>= nr_cycles;
		iocg->delay = 0; /* kick_waitq will recalc */
		iocg_kick_waitq(iocg, true, now);

		TRACE_IOCG_PATH(iocg_forgive_debt, iocg, now, usage_pct,
				old_debt, iocg->abs_vdebt,
				old_delay, iocg->delay);

		spin_unlock(&iocg->waitq.lock);
	}
}
+41 −0
Original line number Diff line number Diff line
@@ -164,6 +164,47 @@ TRACE_EVENT(iocost_ioc_vrate_adj,
	)
);

TRACE_EVENT(iocost_iocg_forgive_debt,

	TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
		u32 usage_pct, u64 old_debt, u64 new_debt,
		u64 old_delay, u64 new_delay),

	TP_ARGS(iocg, path, now, usage_pct,
		old_debt, new_debt, old_delay, new_delay),

	TP_STRUCT__entry (
		__string(devname, ioc_name(iocg->ioc))
		__string(cgroup, path)
		__field(u64, now)
		__field(u64, vnow)
		__field(u32, usage_pct)
		__field(u64, old_debt)
		__field(u64, new_debt)
		__field(u64, old_delay)
		__field(u64, new_delay)
	),

	TP_fast_assign(
		__assign_str(devname, ioc_name(iocg->ioc));
		__assign_str(cgroup, path);
		__entry->now = now->now;
		__entry->vnow = now->vnow;
		__entry->usage_pct = usage_pct;
		__entry->old_debt = old_debt;
		__entry->new_debt = new_debt;
		__entry->old_delay = old_delay;
		__entry->new_delay = new_delay;
	),

	TP_printk("[%s:%s] now=%llu:%llu usage=%u debt=%llu->%llu delay=%llu->%llu",
		__get_str(devname), __get_str(cgroup),
		__entry->now, __entry->vnow, __entry->usage_pct,
		__entry->old_debt, __entry->new_debt,
		__entry->old_delay, __entry->new_delay
	)
);

#endif /* _TRACE_BLK_IOCOST_H */

/* This part must be outside protection */