diff options
author | Mel Gorman <mel@csn.ul.ie> | 2010-10-26 17:21:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:07 -0400 |
commit | 52bb9198668968506f9d12bf35d7f5d3f094921e (patch) | |
tree | 6e1f79c46de902c4462054803eb13115673f8c8c | |
parent | e11da5b4fdf01d71d73c21cb92b00595b917d7fd (diff) |
writeback: account for time spent congestion_waited
There is strong evidence to indicate a lot of time is being spent in
congestion_wait(), some of it unnecessarily. This patch adds a tracepoint
for congestion_wait to record when congestion_wait() was called, how long
the timeout was for and how long it actually slept.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/trace/events/writeback.h | 28 | ||||
-rw-r--r-- | mm/backing-dev.c | 5 |
2 files changed, 33 insertions, 0 deletions
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 0bb01ab2e984..d2b2654606ec 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -151,6 +151,34 @@ DEFINE_WBC_EVENT(wbc_balance_dirty_written); | |||
151 | DEFINE_WBC_EVENT(wbc_balance_dirty_wait); | 151 | DEFINE_WBC_EVENT(wbc_balance_dirty_wait); |
152 | DEFINE_WBC_EVENT(wbc_writepage); | 152 | DEFINE_WBC_EVENT(wbc_writepage); |
153 | 153 | ||
154 | DECLARE_EVENT_CLASS(writeback_congest_waited_template, | ||
155 | |||
156 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | ||
157 | |||
158 | TP_ARGS(usec_timeout, usec_delayed), | ||
159 | |||
160 | TP_STRUCT__entry( | ||
161 | __field( unsigned int, usec_timeout ) | ||
162 | __field( unsigned int, usec_delayed ) | ||
163 | ), | ||
164 | |||
165 | TP_fast_assign( | ||
166 | __entry->usec_timeout = usec_timeout; | ||
167 | __entry->usec_delayed = usec_delayed; | ||
168 | ), | ||
169 | |||
170 | TP_printk("usec_timeout=%u usec_delayed=%u", | ||
171 | __entry->usec_timeout, | ||
172 | __entry->usec_delayed) | ||
173 | ); | ||
174 | |||
175 | DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, | ||
176 | |||
177 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | ||
178 | |||
179 | TP_ARGS(usec_timeout, usec_delayed) | ||
180 | ); | ||
181 | |||
154 | #endif /* _TRACE_WRITEBACK_H */ | 182 | #endif /* _TRACE_WRITEBACK_H */ |
155 | 183 | ||
156 | /* This part must be outside protection */ | 184 | /* This part must be outside protection */ |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 65d420499a61..55627306abe0 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -764,12 +764,17 @@ EXPORT_SYMBOL(set_bdi_congested); | |||
764 | long congestion_wait(int sync, long timeout) | 764 | long congestion_wait(int sync, long timeout) |
765 | { | 765 | { |
766 | long ret; | 766 | long ret; |
767 | unsigned long start = jiffies; | ||
767 | DEFINE_WAIT(wait); | 768 | DEFINE_WAIT(wait); |
768 | wait_queue_head_t *wqh = &congestion_wqh[sync]; | 769 | wait_queue_head_t *wqh = &congestion_wqh[sync]; |
769 | 770 | ||
770 | prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); | 771 | prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); |
771 | ret = io_schedule_timeout(timeout); | 772 | ret = io_schedule_timeout(timeout); |
772 | finish_wait(wqh, &wait); | 773 | finish_wait(wqh, &wait); |
774 | |||
775 | trace_writeback_congestion_wait(jiffies_to_usecs(timeout), | ||
776 | jiffies_to_usecs(jiffies - start)); | ||
777 | |||
773 | return ret; | 778 | return ret; |
774 | } | 779 | } |
775 | EXPORT_SYMBOL(congestion_wait); | 780 | EXPORT_SYMBOL(congestion_wait); |