mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-05 23:56:58 +00:00
scoutfs: add shrink exit trace points
Add trace points that show the incoming nr_to_scan and resulting object count for shrinker calls. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+4
-1
@@ -1748,6 +1748,7 @@ static int item_lru_shrink(struct shrinker *shrink, struct shrink_control *sc)
|
||||
struct cached_item *end;
|
||||
unsigned long flags;
|
||||
unsigned long nr;
|
||||
int ret;
|
||||
|
||||
nr = sc->nr_to_scan;
|
||||
if (nr == 0)
|
||||
@@ -1848,7 +1849,9 @@ abort:
|
||||
spin_unlock_irqrestore(&cac->lock, flags);
|
||||
|
||||
out:
|
||||
return min_t(unsigned long, cac->lru_nr, INT_MAX);
|
||||
ret = min_t(unsigned long, cac->lru_nr, INT_MAX);
|
||||
trace_scoutfs_item_shrink_exit(sb, sc->nr_to_scan, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void *copy_key_with_len(void *data, struct scoutfs_key_buf *key)
|
||||
|
||||
+4
-1
@@ -345,6 +345,7 @@ static int shrink_lock_tree(struct shrinker *shrink, struct shrink_control *sc)
|
||||
struct scoutfs_lock *tmp;
|
||||
unsigned long flags;
|
||||
unsigned long nr;
|
||||
int ret;
|
||||
|
||||
nr = sc->nr_to_scan;
|
||||
if (!nr)
|
||||
@@ -368,7 +369,9 @@ static int shrink_lock_tree(struct shrinker *shrink, struct shrink_control *sc)
|
||||
spin_unlock_irqrestore(&linfo->lock, flags);
|
||||
|
||||
out:
|
||||
return min_t(unsigned long, linfo->lru_nr, INT_MAX);
|
||||
ret = min_t(unsigned long, linfo->lru_nr, INT_MAX);
|
||||
trace_scoutfs_lock_shrink_exit(linfo->sb, sc->nr_to_scan, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void free_lock_tree(struct super_block *sb)
|
||||
|
||||
@@ -1650,6 +1650,38 @@ TRACE_EVENT(scoutfs_item_next_range_check,
|
||||
__get_str(last), __get_str(end), __get_str(range_end))
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(scoutfs_shrink_exit_class,
|
||||
TP_PROTO(struct super_block *sb, unsigned long nr_to_scan, int ret),
|
||||
TP_ARGS(sb, nr_to_scan, ret),
|
||||
TP_STRUCT__entry(
|
||||
__field(void *, sb)
|
||||
__field(unsigned long, nr_to_scan)
|
||||
__field(int, ret)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->sb = sb;
|
||||
__entry->nr_to_scan = nr_to_scan;
|
||||
__entry->ret = ret;
|
||||
),
|
||||
TP_printk("sb %p nr_to_scan %lu ret %d",
|
||||
__entry->sb, __entry->nr_to_scan, __entry->ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(scoutfs_shrink_exit_class, scoutfs_lock_shrink_exit,
|
||||
TP_PROTO(struct super_block *sb, unsigned long nr_to_scan, int ret),
|
||||
TP_ARGS(sb, nr_to_scan, ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(scoutfs_shrink_exit_class, scoutfs_seg_shrink_exit,
|
||||
TP_PROTO(struct super_block *sb, unsigned long nr_to_scan, int ret),
|
||||
TP_ARGS(sb, nr_to_scan, ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(scoutfs_shrink_exit_class, scoutfs_item_shrink_exit,
|
||||
TP_PROTO(struct super_block *sb, unsigned long nr_to_scan, int ret),
|
||||
TP_ARGS(sb, nr_to_scan, ret)
|
||||
);
|
||||
|
||||
#endif /* _TRACE_SCOUTFS_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
+4
-1
@@ -716,6 +716,7 @@ static int seg_lru_shrink(struct shrinker *shrink, struct shrink_control *sc)
|
||||
unsigned long flags;
|
||||
unsigned long nr;
|
||||
LIST_HEAD(list);
|
||||
int ret;
|
||||
|
||||
nr = sc->nr_to_scan;
|
||||
if (!nr)
|
||||
@@ -746,7 +747,9 @@ static int seg_lru_shrink(struct shrinker *shrink, struct shrink_control *sc)
|
||||
}
|
||||
|
||||
out:
|
||||
return min_t(unsigned long, cac->lru_nr, INT_MAX);
|
||||
ret = min_t(unsigned long, cac->lru_nr, INT_MAX);
|
||||
trace_scoutfs_seg_shrink_exit(sb, sc->nr_to_scan, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int scoutfs_seg_setup(struct super_block *sb)
|
||||
|
||||
Reference in New Issue
Block a user