Re: [PATCH 12/35] writeback: scale down max throttle bandwidth on concurrent dirtiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 14, 2010 at 09:21:19AM +0800, Yan Zheng wrote:
> On Mon, Dec 13, 2010 at 10:46 PM, Wu Fengguang <fengguang.wu@xxxxxxxxx> wrote:
> > This will noticeably reduce the fluctuaions of pause time when there are
> > 100+ concurrent dirtiers.
> >
> > The more parallel dirtiers (1 dirtier => 4 dirtiers), the smaller
> > bandwidth each dirtier will share (bdi_bandwidth => bdi_bandwidth/4),
> > the less gap to the dirty limit ((C-A) => (C-B)), the less stable the
> > pause time will be (given the same fluctuation of bdi_dirty).
> >
> > For example, if A drifts to A', its pause time may drift from 5ms to
> > 6ms, while B to B' may drift from 50ms to 90ms. ÂIt's much larger
> > fluctuations in relative ratio as well as absolute time.
> >
> > Fig.1 before patch, gap (C-B) is too low to get smooth pause time
> >
> > throttle_bandwidth_A = bdi_bandwidth .........o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| o <= A'
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â Â o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â Â Â o
> > throttle_bandwidth_B = bdi_bandwidth / 4 .....|...........o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â Â Â Â | o <= B'
> > ----------------------------------------------+-----------+---o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂA Â Â Â Â Â B Â C
> >
> > The solution is to lower the slope of the throttle line accordingly,
> > which makes B stabilize at some point more far away from C.
> >
> > Fig.2 after patch
> >
> > throttle_bandwidth_A = bdi_bandwidth .........o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| o <= A'
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â o
> > Â Âlowered max throttle bandwidth for B ===> * Â Â Â o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â * Â Â o
> > throttle_bandwidth_B = bdi_bandwidth / 4 .............* Â o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â| Â Â Â | Â * o
> > ----------------------------------------------+-------+-------o
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂA Â Â Â B Â Â Â C
> >
> > Note that C is actually different points for 1-dirty and 4-dirtiers
> > cases, but for easy graphing, we move them together.
> >
> > Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
> > ---
> > Âmm/page-writeback.c | Â 16 +++++++++++++---
> > Â1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > --- linux-next.orig/mm/page-writeback.c 2010-12-13 21:46:14.000000000 +0800
> > +++ linux-next/mm/page-writeback.c   Â2010-12-13 21:46:15.000000000 +0800
> > @@ -587,6 +587,7 @@ static void balance_dirty_pages(struct a
> > Â Â Â Âunsigned long background_thresh;
> > Â Â Â Âunsigned long dirty_thresh;
> > Â Â Â Âunsigned long bdi_thresh;
> > + Â Â Â unsigned long task_thresh;
> > Â Â Â Âunsigned long long bw;
> > Â Â Â Âunsigned long period;
> > Â Â Â Âunsigned long pause = 0;
> > @@ -616,7 +617,7 @@ static void balance_dirty_pages(struct a
> > Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> >
> > Â Â Â Â Â Â Â Âbdi_thresh = bdi_dirty_limit(bdi, dirty_thresh, nr_dirty);
> > - Â Â Â Â Â Â Â bdi_thresh = task_dirty_limit(current, bdi_thresh);
> > + Â Â Â Â Â Â Â task_thresh = task_dirty_limit(current, bdi_thresh);
> >
> > Â Â Â Â Â Â Â Â/*
> > Â Â Â Â Â Â Â Â * In order to avoid the stacked BDI deadlock we need
> > @@ -638,14 +639,23 @@ static void balance_dirty_pages(struct a
> >
> > Â Â Â Â Â Â Â Âbdi_update_bandwidth(bdi, start_time, bdi_dirty, bdi_thresh);
> >
> > - Â Â Â Â Â Â Â if (bdi_dirty >= bdi_thresh || nr_dirty > dirty_thresh) {
> > + Â Â Â Â Â Â Â if (bdi_dirty >= task_thresh || nr_dirty > dirty_thresh) {
> > Â Â Â Â Â Â Â Â Â Â Â Âpause = MAX_PAUSE;
> > Â Â Â Â Â Â Â Â Â Â Â Âgoto pause;
> > Â Â Â Â Â Â Â Â}
> >
> > + Â Â Â Â Â Â Â /*
> > + Â Â Â Â Â Â Â Â* When bdi_dirty grows closer to bdi_thresh, it indicates more
> > + Â Â Â Â Â Â Â Â* concurrent dirtiers. Proportionally lower the max throttle
> > + Â Â Â Â Â Â Â Â* bandwidth. This will resist bdi_dirty from approaching to
> > + Â Â Â Â Â Â Â Â* close to task_thresh, and help reduce fluctuations of pause
> > + Â Â Â Â Â Â Â Â* time when there are lots of dirtiers.
> > + Â Â Â Â Â Â Â Â*/
> > Â Â Â Â Â Â Â Âbw = bdi->write_bandwidth;
> > -
> > Â Â Â Â Â Â Â Âbw = bw * (bdi_thresh - bdi_dirty);
> > + Â Â Â Â Â Â Â do_div(bw, bdi_thresh / BDI_SOFT_DIRTY_LIMIT + 1);
> > +
> > + Â Â Â Â Â Â Â bw = bw * (task_thresh - bdi_dirty);
> > Â Â Â Â Â Â Â Âdo_div(bw, bdi_thresh / TASK_SOFT_DIRTY_LIMIT + 1);
> 
> Maybe changing this line to "do_div(bw, task_thresh /
> TASK_SOFT_DIRTY_LIMIT + 1);"
> is more consistent.

I'll show you another consistency of "shape" :)

http://www.kernel.org/pub/linux/kernel/people/wfg/writeback/slides/light-dirtier-control-line.svg
http://www.kernel.org/pub/linux/kernel/people/wfg/writeback/slides/heavy-dirtier-control-line.svg

In the above two figures, the overall control lines for light/heavy
dirtier tasks have exactly the same shape -- it's merely shifted in
the X axis direction. So the current form is actually more simple.

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]