[PATCH 06/17] writeback: move task dirty fraction to balance_dirty_pages()

From: Wu Fengguang
Date: Sun Sep 12 2010 - 11:55:48 EST


This is simple code refactor preparing for a trace event that exposes
the fraction info. It may be merged with the next patch eventually.

CC: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
mm/page-writeback.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

--- linux-next.orig/mm/page-writeback.c 2010-09-09 16:02:27.000000000 +0800
+++ linux-next/mm/page-writeback.c 2010-09-09 16:02:30.000000000 +0800
@@ -260,14 +260,12 @@ static inline void task_dirties_fraction
* effectively curb the growth of dirty pages. Light dirtiers with high enough
* dirty threshold may never get throttled.
*/
-static unsigned long task_dirty_limit(struct task_struct *tsk,
- unsigned long bdi_dirty)
+static unsigned long task_dirty_limit(unsigned long bdi_dirty,
+ long numerator, long denominator)
{
- long numerator, denominator;
unsigned long dirty = bdi_dirty;
u64 inv = dirty / DIRTY_SOFT_THROTTLE_RATIO;

- task_dirties_fraction(tsk, &numerator, &denominator);
inv *= numerator;
do_div(inv, denominator);

@@ -472,6 +470,7 @@ static void balance_dirty_pages(struct a
unsigned long bw;
bool dirty_exceeded = false;
struct backing_dev_info *bdi = mapping->backing_dev_info;
+ long numerator, denominator;

for (;;) {
/*
@@ -496,8 +495,10 @@ static void balance_dirty_pages(struct a
(background_thresh + dirty_thresh) / 2)
break;

+ task_dirties_fraction(current, &numerator, &denominator);
bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh);
- bdi_thresh = task_dirty_limit(current, bdi_thresh);
+ bdi_thresh = task_dirty_limit(bdi_thresh,
+ numerator, denominator);

/*
* In order to avoid the stacked BDI deadlock we need


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/