mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
NFSD: Report the number of items evicted by the LRU walk
Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
39f1d1ff81
commit
94660cc19c
@ -46,6 +46,7 @@ static DEFINE_PER_CPU(unsigned long, nfsd_file_cache_hits);
|
||||
static DEFINE_PER_CPU(unsigned long, nfsd_file_acquisitions);
|
||||
static DEFINE_PER_CPU(unsigned long, nfsd_file_releases);
|
||||
static DEFINE_PER_CPU(unsigned long, nfsd_file_total_age);
|
||||
static DEFINE_PER_CPU(unsigned long, nfsd_file_evictions);
|
||||
|
||||
struct nfsd_fcache_disposal {
|
||||
struct work_struct work;
|
||||
@ -446,6 +447,7 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru,
|
||||
goto out_skip;
|
||||
|
||||
list_lru_isolate_move(lru, &nf->nf_lru, head);
|
||||
this_cpu_inc(nfsd_file_evictions);
|
||||
return LRU_REMOVED;
|
||||
out_skip:
|
||||
return LRU_SKIP;
|
||||
@ -476,9 +478,11 @@ static void
|
||||
nfsd_file_gc(void)
|
||||
{
|
||||
LIST_HEAD(dispose);
|
||||
unsigned long ret;
|
||||
|
||||
list_lru_walk(&nfsd_file_lru, nfsd_file_lru_cb,
|
||||
&dispose, LONG_MAX);
|
||||
ret = list_lru_walk(&nfsd_file_lru, nfsd_file_lru_cb,
|
||||
&dispose, LONG_MAX);
|
||||
trace_nfsd_file_gc_removed(ret, list_lru_count(&nfsd_file_lru));
|
||||
nfsd_file_gc_dispose_list(&dispose);
|
||||
}
|
||||
|
||||
@ -503,6 +507,7 @@ nfsd_file_lru_scan(struct shrinker *s, struct shrink_control *sc)
|
||||
|
||||
ret = list_lru_shrink_walk(&nfsd_file_lru, sc,
|
||||
nfsd_file_lru_cb, &dispose);
|
||||
trace_nfsd_file_shrinker_removed(ret, list_lru_count(&nfsd_file_lru));
|
||||
nfsd_file_gc_dispose_list(&dispose);
|
||||
return ret;
|
||||
}
|
||||
@ -1065,7 +1070,7 @@ nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
*/
|
||||
static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
|
||||
{
|
||||
unsigned long hits = 0, acquisitions = 0, releases = 0;
|
||||
unsigned long hits = 0, acquisitions = 0, releases = 0, evictions = 0;
|
||||
unsigned int i, count = 0, longest = 0;
|
||||
unsigned long lru = 0, total_age = 0;
|
||||
|
||||
@ -1089,6 +1094,7 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
|
||||
acquisitions += per_cpu(nfsd_file_acquisitions, i);
|
||||
releases += per_cpu(nfsd_file_releases, i);
|
||||
total_age += per_cpu(nfsd_file_total_age, i);
|
||||
evictions += per_cpu(nfsd_file_evictions, i);
|
||||
}
|
||||
|
||||
seq_printf(m, "total entries: %u\n", count);
|
||||
@ -1097,6 +1103,7 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
|
||||
seq_printf(m, "cache hits: %lu\n", hits);
|
||||
seq_printf(m, "acquisitions: %lu\n", acquisitions);
|
||||
seq_printf(m, "releases: %lu\n", releases);
|
||||
seq_printf(m, "evictions: %lu\n", evictions);
|
||||
if (releases)
|
||||
seq_printf(m, "mean age (ms): %ld\n", total_age / releases);
|
||||
else
|
||||
|
@ -895,6 +895,35 @@ TRACE_EVENT(nfsd_file_fsnotify_handle_event,
|
||||
__entry->nlink, __entry->mode, __entry->mask)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(nfsd_file_lruwalk_class,
|
||||
TP_PROTO(
|
||||
unsigned long removed,
|
||||
unsigned long remaining
|
||||
),
|
||||
TP_ARGS(removed, remaining),
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned long, removed)
|
||||
__field(unsigned long, remaining)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->removed = removed;
|
||||
__entry->remaining = remaining;
|
||||
),
|
||||
TP_printk("%lu entries removed, %lu remaining",
|
||||
__entry->removed, __entry->remaining)
|
||||
);
|
||||
|
||||
#define DEFINE_NFSD_FILE_LRUWALK_EVENT(name) \
|
||||
DEFINE_EVENT(nfsd_file_lruwalk_class, name, \
|
||||
TP_PROTO( \
|
||||
unsigned long removed, \
|
||||
unsigned long remaining \
|
||||
), \
|
||||
TP_ARGS(removed, remaining))
|
||||
|
||||
DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed);
|
||||
DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed);
|
||||
|
||||
#include "cache.h"
|
||||
|
||||
TRACE_DEFINE_ENUM(RC_DROPIT);
|
||||
|
Loading…
Reference in New Issue
Block a user