Re: [PATCH v2 1/3] writeback: Let trace_balance_dirty_pages() take struct dtc as parameter
From: Steven Rostedt
Date: Tue Mar 04 2025 - 11:06:17 EST
On Tue, 4 Mar 2025 19:03:16 +0800
Tang Yizhou <yizhou.tang@xxxxxxxxxx> wrote:
> @@ -664,16 +660,16 @@ TRACE_EVENT(balance_dirty_pages,
> ),
>
> TP_fast_assign(
> - unsigned long freerun = (thresh + bg_thresh) / 2;
> + unsigned long freerun = (dtc->thresh + dtc->bg_thresh) / 2;
> strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32);
>
> __entry->limit = global_wb_domain.dirty_limit;
> __entry->setpoint = (global_wb_domain.dirty_limit +
> freerun) / 2;
> - __entry->dirty = dirty;
> + __entry->dirty = dtc->dirty;
> __entry->bdi_setpoint = __entry->setpoint *
> - bdi_thresh / (thresh + 1);
> - __entry->bdi_dirty = bdi_dirty;
> + dtc->wb_thresh / (dtc->thresh + 1);
> + __entry->bdi_dirty = dtc->wb_dirty;
> __entry->dirty_ratelimit = KBps(dirty_ratelimit);
> __entry->task_ratelimit = KBps(task_ratelimit);
> __entry->dirtied = dirtied;
I don't know how much of a fast path these tracepoints are in, but instead
of doing the divisions above, why not just save the values in the ring
buffer, and do the divisions in the TP_printk() section, which is done when
the user reads it and not when the code is executing?
-- Steve