提交 c9c12971 编写于 作者: D Dave Chinner 提交者: Alex Elder

xfs: Don't wake xfsbufd when idle

The xfsbufd wakes every xfsbufd_centisecs (once per second by
default) for each filesystem even when the filesystem is idle.  If
the xfsbufd has nothing to do, put it into a long term sleep and
only wake it up when there is work pending (i.e. dirty buffers to
flush soon). This will make laptop power misers happy.
Signed-off-by: NDave Chinner <david@fromorbit.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 453eac8a
...@@ -1595,6 +1595,11 @@ xfs_buf_delwri_queue( ...@@ -1595,6 +1595,11 @@ xfs_buf_delwri_queue(
list_del(&bp->b_list); list_del(&bp->b_list);
} }
if (list_empty(dwq)) {
/* start xfsbufd as it is about to have something to do */
wake_up_process(bp->b_target->bt_task);
}
bp->b_flags |= _XBF_DELWRI_Q; bp->b_flags |= _XBF_DELWRI_Q;
list_add_tail(&bp->b_list, dwq); list_add_tail(&bp->b_list, dwq);
bp->b_queuetime = jiffies; bp->b_queuetime = jiffies;
...@@ -1644,6 +1649,8 @@ xfsbufd_wakeup( ...@@ -1644,6 +1649,8 @@ xfsbufd_wakeup(
list_for_each_entry(btp, &xfs_buftarg_list, bt_list) { list_for_each_entry(btp, &xfs_buftarg_list, bt_list) {
if (test_bit(XBT_FORCE_SLEEP, &btp->bt_flags)) if (test_bit(XBT_FORCE_SLEEP, &btp->bt_flags))
continue; continue;
if (list_empty(&btp->bt_delwrite_queue))
continue;
set_bit(XBT_FORCE_FLUSH, &btp->bt_flags); set_bit(XBT_FORCE_FLUSH, &btp->bt_flags);
wake_up_process(btp->bt_task); wake_up_process(btp->bt_task);
} }
...@@ -1708,6 +1715,9 @@ xfsbufd( ...@@ -1708,6 +1715,9 @@ xfsbufd(
set_freezable(); set_freezable();
do { do {
long age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10);
if (unlikely(freezing(current))) { if (unlikely(freezing(current))) {
set_bit(XBT_FORCE_SLEEP, &target->bt_flags); set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
refrigerator(); refrigerator();
...@@ -1715,12 +1725,12 @@ xfsbufd( ...@@ -1715,12 +1725,12 @@ xfsbufd(
clear_bit(XBT_FORCE_SLEEP, &target->bt_flags); clear_bit(XBT_FORCE_SLEEP, &target->bt_flags);
} }
schedule_timeout_interruptible( /* sleep for a long time if there is nothing to do. */
xfs_buf_timer_centisecs * msecs_to_jiffies(10)); if (list_empty(&target->bt_delwrite_queue))
tout = MAX_SCHEDULE_TIMEOUT;
xfs_buf_delwri_split(target, &tmp, schedule_timeout_interruptible(tout);
xfs_buf_age_centisecs * msecs_to_jiffies(10));
xfs_buf_delwri_split(target, &tmp, age);
count = 0; count = 0;
while (!list_empty(&tmp)) { while (!list_empty(&tmp)) {
bp = list_entry(tmp.next, xfs_buf_t, b_list); bp = list_entry(tmp.next, xfs_buf_t, b_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册