[PATCH] fix task dirty balancing

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <a.p.zijlstra@...>
Cc: <linux-kernel@...>
Date: Wednesday, July 2, 2008 - 4:26 am

hi,

task_dirty_inc doesn't seem to be called properly for
filesystems which don't use set_page_dirty for write(2).
eg. ext2 w/o nobh option.

YAMAMOTO Takashi


Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
---

commit e68f05bf56d0652c107bba1cff3f8491e41a2117
Author: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Date:   Wed Jul 2 16:17:33 2008 +0900

    fix dirty balancing for tasks.
    
    call task_dirty_inc when dirtying a page with mark_buffer_dirty.

diff --git a/fs/buffer.c b/fs/buffer.c
index 4788a9e..2f1c7c6 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1219,8 +1219,9 @@ void mark_buffer_dirty(struct buffer_head *bh)
 			return;
 	}
 
-	if (!test_set_buffer_dirty(bh))
-		__set_page_dirty(bh->b_page, page_mapping(bh->b_page), 0);
+	if (!test_set_buffer_dirty(bh) &&
+	    __set_page_dirty(bh->b_page, page_mapping(bh->b_page), 0))
+		task_dirty_inc(current);
 }
 
 /*
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index bd91987..61d0aec 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -95,6 +95,7 @@ int wakeup_pdflush(long nr_pages);
 void laptop_io_completion(void);
 void laptop_sync_completion(void);
 void throttle_vm_writeout(gfp_t gfp_mask);
+void task_dirty_inc(struct task_struct *);
 
 /* These are exported to sysctl. */
 extern int dirty_background_ratio;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 29b1d1e..4dc85d0 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -176,10 +176,11 @@ void bdi_writeout_inc(struct backing_dev_info *bdi)
 }
 EXPORT_SYMBOL_GPL(bdi_writeout_inc);
 
-static inline void task_dirty_inc(struct task_struct *tsk)
+void task_dirty_inc(struct task_struct *tsk)
 {
 	prop_inc_single(&vm_dirties, &tsk->dirties);
 }
+EXPORT_SYMBOL_GPL(task_dirty_inc);
 
 /*
  * Obtain an accurate fraction of the BDI's portion.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Wed Jul 2, 4:26 am)
Re: [PATCH] fix task dirty balancing, Peter Zijlstra, (Wed Jul 2, 4:27 pm)
Re: [PATCH] fix task dirty balancing, KAMEZAWA Hiroyuki, (Sat Jul 5, 2:04 am)
Re: [PATCH] fix task dirty balancing, Peter Zijlstra, (Sat Jul 5, 5:30 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Tue Jul 8, 7:38 pm)
Re: [PATCH] fix task dirty balancing, Nick Piggin, (Wed Jul 9, 3:41 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Wed Jul 9, 11:10 pm)
Re: [PATCH] fix task dirty balancing, Nick Piggin, (Thu Jul 10, 3:23 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Wed Jul 23, 8:27 pm)
Re: [PATCH] fix task dirty balancing, Nick Piggin, (Thu Jul 24, 11:08 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Fri Jul 25, 4:04 am)
Re: [PATCH] fix task dirty balancing, Peter Zijlstra, (Fri Jul 25, 5:57 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Mon Jul 28, 1:50 am)
Re: [PATCH] fix task dirty balancing, Peter Zijlstra, (Mon Jul 28, 3:24 am)
Re: [PATCH] fix task dirty balancing, Nick Piggin, (Mon Jul 7, 6:36 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Mon Jul 7, 2:46 am)
Re: [PATCH] fix task dirty balancing, YAMAMOTO Takashi, (Thu Jul 3, 3:33 am)