Re: [patch 2/2] mm: add dirty_background_bytes and dirty_bytessysctls

From: David Rientjes
Date: Mon Nov 24 2008 - 20:05:44 EST


On Mon, 24 Nov 2008, Randy Dunlap wrote:

> >> - if (background_ratio >= dirty_ratio)
> >> - background_ratio = dirty_ratio / 2;
> >> + dirty_ratio = vm_dirty_ratio;
> >> + if (dirty_ratio < 5)
> >> + dirty_ratio = 5;
> >> + dirty = (dirty_ratio * available_memory) / 100;
> >> + }
> >> +
> >> + if (dirty_background_bytes)
> >> + background = (dirty_background_bytes + PAGE_SIZE) / PAGE_SIZE;
> >
> > DIV_ROUND_UP()?
>
> Note that DIV_ROUND_UP() would make that
>
> background = (dirty_background_byte + PAGE_SIZE - 1) / PAGE_SIZE;
>
> but that's usually what is needed/intended.
>

Good point. If we were to do this, then dirty_bytes and
dirty_background_bytes should use 1 instead of 0 as the minimum acceptable
value in proc_dointvec_minmax(). Otherwise, get_dirty_limits() would
return 0 pages for the dirty limit when 0 is written to either file since
integer division truncates and we'd be in a constant state of writeback :)
--
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/