aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-15 01:03:14 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:44 -0400
commitd7e4e51370ef62776ea4af22f83047640425efda (patch)
tree349103c04bafdcf0d6db1782300221e90f544ecf /fs/bcachefs/btree_locking.h
parentfe5b37f699c02f90505933959797f70645ba95fb (diff)
bcachefs: Switch to local_clock() for fastpath time source
local_clock() isn't always completely accurate - e.g. on machines with TSC drift - but ktime_get_ns() overhead is too high, unfortunately. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.h')
-rw-r--r--fs/bcachefs/btree_locking.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index c74a5fd4d908..3356f089e268 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -87,7 +87,7 @@ static inline void mark_btree_node_locked(struct btree_trans *trans,
{
mark_btree_node_locked_noreset(path, level, type);
#ifdef CONFIG_BCACHEFS_LOCK_TIME_STATS
- path->l[level].lock_taken_time = ktime_get_ns();
+ path->l[level].lock_taken_time = local_clock();
#endif
}
@@ -119,7 +119,7 @@ static void btree_trans_lock_hold_time_update(struct btree_trans *trans,
if (s)
__bch2_time_stats_update(&s->lock_hold_times,
path->l[level].lock_taken_time,
- ktime_get_ns());
+ local_clock());
#endif
}
@@ -259,7 +259,7 @@ static inline int btree_node_lock(struct btree_trans *trans,
btree_node_lock_increment(trans, b, level, type) ||
!(ret = btree_node_lock_nopath(trans, b, type))) {
#ifdef CONFIG_BCACHEFS_LOCK_TIME_STATS
- path->l[b->level].lock_taken_time = ktime_get_ns();
+ path->l[b->level].lock_taken_time = local_clock();
#endif
}