bcachefs: Separate running/runnable in wp stats

We've got per-writepoint statistics to see how well the writepoint index
update threads are pipelining; this separates running vs. runnable so we
can see at a glance if they're blocking.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-01-22 14:38:59 -05:00
parent 78c9c6f6cd
commit 999cc1bb68
2 changed files with 11 additions and 1 deletions

View File

@ -90,6 +90,7 @@ struct dev_stripe_state {
x(stopped) \
x(waiting_io) \
x(waiting_work) \
x(runnable) \
x(running)
enum write_point_state {
@ -125,6 +126,7 @@ struct write_point {
enum write_point_state state;
u64 last_state_change;
u64 time[WRITE_POINT_STATE_NR];
u64 last_runtime;
} __aligned(SMP_CACHE_BYTES);
};

View File

@ -587,7 +587,15 @@ err:
static inline void __wp_update_state(struct write_point *wp, enum write_point_state state)
{
if (state != wp->state) {
struct task_struct *p = current;
u64 now = ktime_get_ns();
u64 runtime = p->se.sum_exec_runtime +
(now - p->se.exec_start);
if (state == WRITE_POINT_runnable)
wp->last_runtime = runtime;
else if (wp->state == WRITE_POINT_runnable)
wp->time[WRITE_POINT_running] += runtime - wp->last_runtime;
if (wp->last_state_change &&
time_after64(now, wp->last_state_change))
@ -601,7 +609,7 @@ static inline void wp_update_state(struct write_point *wp, bool running)
{
enum write_point_state state;
state = running ? WRITE_POINT_running :
state = running ? WRITE_POINT_runnable:
!list_empty(&wp->writes) ? WRITE_POINT_waiting_io
: WRITE_POINT_stopped;