From: Dave Chinner <david@fromorbit.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, xfs@oss.sgi.com
Subject: [PATCH 01/12] vmscan: add shrink_slab tracepoints
Date: Thu, 2 Jun 2011 17:00:56 +1000 [thread overview]
Message-ID: <1306998067-27659-2-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1306998067-27659-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Іt is impossible to understand what the shrinkers are actually doing
without instrumenting the code, so add a some tracepoints to allow
insight to be gained.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
include/trace/events/vmscan.h | 67 +++++++++++++++++++++++++++++++++++++++++
mm/vmscan.c | 6 +++-
2 files changed, 72 insertions(+), 1 deletions(-)
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index ea422aa..c798cd7 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -310,6 +310,73 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
show_reclaim_flags(__entry->reclaim_flags))
);
+TRACE_EVENT(mm_shrink_slab_start,
+ TP_PROTO(struct shrinker *shr, struct shrink_control *sc,
+ unsigned long pgs_scanned, unsigned long lru_pgs,
+ unsigned long cache_items, unsigned long long delta,
+ unsigned long total_scan),
+
+ TP_ARGS(shr, sc, pgs_scanned, lru_pgs, cache_items, delta, total_scan),
+
+ TP_STRUCT__entry(
+ __field(struct shrinker *, shr)
+ __field(long, shr_nr)
+ __field(gfp_t, gfp_flags)
+ __field(unsigned long, pgs_scanned)
+ __field(unsigned long, lru_pgs)
+ __field(unsigned long, cache_items)
+ __field(unsigned long long, delta)
+ __field(unsigned long, total_scan)
+ ),
+
+ TP_fast_assign(
+ __entry->shr = shr;
+ __entry->shr_nr = shr->nr;
+ __entry->gfp_flags = sc->gfp_mask;
+ __entry->pgs_scanned = pgs_scanned;
+ __entry->lru_pgs = lru_pgs;
+ __entry->cache_items = cache_items;
+ __entry->delta = delta;
+ __entry->total_scan = total_scan;
+ ),
+
+ TP_printk("shrinker %p: nr %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld",
+ __entry->shr,
+ __entry->shr_nr,
+ show_gfp_flags(__entry->gfp_flags),
+ __entry->pgs_scanned,
+ __entry->lru_pgs,
+ __entry->cache_items,
+ __entry->delta,
+ __entry->total_scan)
+);
+
+TRACE_EVENT(mm_shrink_slab_end,
+ TP_PROTO(struct shrinker *shr, int shrinker_ret,
+ unsigned long total_scan),
+
+ TP_ARGS(shr, shrinker_ret, total_scan),
+
+ TP_STRUCT__entry(
+ __field(struct shrinker *, shr)
+ __field(long, shr_nr)
+ __field(int, shrinker_ret)
+ __field(unsigned long, total_scan)
+ ),
+
+ TP_fast_assign(
+ __entry->shr = shr;
+ __entry->shr_nr = shr->nr;
+ __entry->shrinker_ret = shrinker_ret;
+ __entry->total_scan = total_scan;
+ ),
+
+ TP_printk("shrinker %p: nr %ld total_scan %ld return val %d",
+ __entry->shr,
+ __entry->shr_nr,
+ __entry->total_scan,
+ __entry->shrinker_ret)
+);
#endif /* _TRACE_VMSCAN_H */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index faa0a08..48e3fbd 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -250,6 +250,7 @@ unsigned long shrink_slab(struct shrink_control *shrink,
unsigned long long delta;
unsigned long total_scan;
unsigned long max_pass;
+ int shrink_ret = 0;
max_pass = do_shrinker_shrink(shrinker, shrink, 0);
delta = (4 * nr_pages_scanned) / shrinker->seeks;
@@ -274,9 +275,11 @@ unsigned long shrink_slab(struct shrink_control *shrink,
total_scan = shrinker->nr;
shrinker->nr = 0;
+ trace_mm_shrink_slab_start(shrinker, shrink, nr_pages_scanned,
+ lru_pages, max_pass, delta, total_scan);
+
while (total_scan >= SHRINK_BATCH) {
long this_scan = SHRINK_BATCH;
- int shrink_ret;
int nr_before;
nr_before = do_shrinker_shrink(shrinker, shrink, 0);
@@ -293,6 +296,7 @@ unsigned long shrink_slab(struct shrink_control *shrink,
}
shrinker->nr += total_scan;
+ trace_mm_shrink_slab_end(shrinker, shrink_ret, total_scan);
}
up_read(&shrinker_rwsem);
out:
--
1.7.5.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-06-02 7:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 7:00 [PATCH 0/12] Per superblock cache reclaim Dave Chinner
2011-06-02 7:00 ` Dave Chinner [this message]
2011-06-20 0:44 ` [PATCH 01/12] vmscan: add shrink_slab tracepoints KOSAKI Motohiro
2011-06-20 0:53 ` Dave Chinner
2011-06-02 7:00 ` [PATCH 02/12] vmscan: shrinker->nr updates race and go wrong Dave Chinner
2011-06-20 0:46 ` KOSAKI Motohiro
2011-06-20 1:25 ` Dave Chinner
2011-06-20 4:30 ` KOSAKI Motohiro
2011-06-02 7:00 ` [PATCH 03/12] vmscan: reduce wind up shrinker->nr when shrinker can't do work Dave Chinner
2011-06-20 0:51 ` KOSAKI Motohiro
2011-06-21 5:09 ` Dave Chinner
2011-06-21 5:27 ` KOSAKI Motohiro
2011-06-02 7:00 ` [PATCH 04/12] vmscan: add customisable shrinker batch size Dave Chinner
2011-06-02 7:01 ` [PATCH 05/12] inode: convert inode_stat.nr_unused to per-cpu counters Dave Chinner
2011-06-02 7:01 ` [PATCH 06/12] inode: Make unused inode LRU per superblock Dave Chinner
2011-06-04 0:25 ` Al Viro
2011-06-04 1:40 ` Dave Chinner
2011-06-02 7:01 ` [PATCH 07/12] inode: move to per-sb LRU locks Dave Chinner
2011-06-02 7:01 ` [PATCH 08/12] superblock: introduce per-sb cache shrinker infrastructure Dave Chinner
2011-06-04 0:42 ` Al Viro
2011-06-04 1:52 ` Dave Chinner
2011-06-04 14:08 ` Christoph Hellwig
2011-06-04 14:19 ` Al Viro
2011-06-04 14:24 ` Al Viro
2011-06-02 7:01 ` [PATCH 09/12] inode: remove iprune_sem Dave Chinner
2011-06-02 7:01 ` [PATCH 10/12] superblock: add filesystem shrinker operations Dave Chinner
2011-06-02 7:01 ` [PATCH 11/12] vfs: increase shrinker batch size Dave Chinner
2011-06-02 9:30 ` Nicolas Kaiser
2011-06-02 7:01 ` [PATCH 12/12] xfs: make use of new shrinker callout for the inode cache Dave Chinner
2011-06-16 11:33 ` [PATCH 0/12] Per superblock cache reclaim Christoph Hellwig
2011-06-17 3:35 ` KOSAKI Motohiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306998067-27659-2-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).