lkml.org 
[lkml]   [2011]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 5/6] writeback: trace event writeback_queue_io
Note that it adds a little overheads to account the moved/enqueued
inodes from b_dirty to b_io. The "moved" accounting may be later used to
limit the number of inodes that can be moved in one shot, in order to
keep spinlock hold time under control.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
fs/fs-writeback.c | 16 +++++++++++-----
include/trace/events/writeback.h | 23 +++++++++++++++++++++++
2 files changed, 34 insertions(+), 5 deletions(-)

--- linux-next.orig/fs/fs-writeback.c 2011-05-04 16:01:27.000000000 +0800
+++ linux-next/fs/fs-writeback.c 2011-05-04 16:09:01.000000000 +0800
@@ -248,15 +248,16 @@ static bool inode_dirtied_after(struct i
/*
* Move expired dirty inodes from @delaying_queue to @dispatch_queue.
*/
-static void move_expired_inodes(struct list_head *delaying_queue,
- struct list_head *dispatch_queue,
- struct writeback_control *wbc)
+static int move_expired_inodes(struct list_head *delaying_queue,
+ struct list_head *dispatch_queue,
+ struct writeback_control *wbc)
{
LIST_HEAD(tmp);
struct list_head *pos, *node;
struct super_block *sb = NULL;
struct inode *inode;
int do_sb_sort = 0;
+ int moved = 0;

while (!list_empty(delaying_queue)) {
inode = wb_inode(delaying_queue->prev);
@@ -267,12 +268,13 @@ static void move_expired_inodes(struct l
do_sb_sort = 1;
sb = inode->i_sb;
list_move(&inode->i_wb_list, &tmp);
+ moved++;
}

/* just one sb in list, splice to dispatch_queue and we're done */
if (!do_sb_sort) {
list_splice(&tmp, dispatch_queue);
- return;
+ goto out;
}

/* Move inodes from one superblock together */
@@ -284,6 +286,8 @@ static void move_expired_inodes(struct l
list_move(&inode->i_wb_list, dispatch_queue);
}
}
+out:
+ return moved;
}

/*
@@ -299,9 +303,11 @@ static void move_expired_inodes(struct l
*/
static void queue_io(struct bdi_writeback *wb, struct writeback_control *wbc)
{
+ int moved;
assert_spin_locked(&wb->list_lock);
list_splice_init(&wb->b_more_io, &wb->b_io);
- move_expired_inodes(&wb->b_dirty, &wb->b_io, wbc);
+ moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, wbc);
+ trace_writeback_queue_io(wb, wbc, moved);
}

static int write_inode(struct inode *inode, struct writeback_control *wbc)
--- linux-next.orig/include/trace/events/writeback.h 2011-05-04 16:06:50.000000000 +0800
+++ linux-next/include/trace/events/writeback.h 2011-05-04 16:08:58.000000000 +0800
@@ -165,6 +165,29 @@ DEFINE_WBC_EVENT(wbc_balance_dirty_writt
DEFINE_WBC_EVENT(wbc_balance_dirty_wait);
DEFINE_WBC_EVENT(wbc_writepage);

+TRACE_EVENT(writeback_queue_io,
+ TP_PROTO(struct bdi_writeback *wb,
+ struct writeback_control *wbc,
+ int moved),
+ TP_ARGS(wb, wbc, moved),
+ TP_STRUCT__entry(
+ __array(char, name, 32)
+ __field(int, older)
+ __field(int, moved)
+ ),
+ TP_fast_assign(
+ strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
+ __entry->older = wbc->older_than_this ?
+ (jiffies - *wbc->older_than_this) * 1000 / HZ
+ : -1;
+ __entry->moved = moved;
+ ),
+ TP_printk("bdi %s: older=%d enqueue=%d",
+ __entry->name,
+ __entry->older,
+ __entry->moved)
+);
+
DECLARE_EVENT_CLASS(writeback_congest_waited_template,

TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),



\
 
 \ /
  Last update: 2011-05-04 11:31    [W:0.106 / U:1.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site