Skip to content

Commit

Permalink
iocost: add iocg_forgive_debt tracepoint
Browse files Browse the repository at this point in the history
Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and axboe committed Sep 25, 2020
1 parent c7af2a0 commit c5a6561
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
12 changes: 12 additions & 0 deletions block/blk-iocost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
41 changes: 41 additions & 0 deletions include/trace/events/iocost.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit c5a6561

Please sign in to comment.