Re: [PATCH block/for-4.7-fixes] writeback: use higher precision calculation in domain_dirty_limits()

From: Jan Kara
Date: Mon May 30 2016 - 04:05:19 EST


On Fri 27-05-16 14:34:46, Tejun Heo wrote:
> As vm.dirty_[background_]bytes can't be applied verbatim to multiple
> cgroup writeback domains, they get converted to percentages in
> domain_dirty_limits() and applied the same way as
> vm.dirty_[background]ratio. However, if the specified bytes is lower
> than 1% of available memory, the calculated ratios become zero and the
> writeback domain gets throttled constantly.
>
> Fix it by using per-PAGE_SIZE instead of percentage for ratio
> calculations. Also, the updated DIV_ROUND_UP() usages now should
> yield 1/4096 (0.0244%) as the minimum ratio as long as the specified
> bytes are above zero.

The patch looks good to me. You can add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Just one nit below:

> @@ -386,26 +387,28 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc)
> /*
> * The byte settings can't be applied directly to memcg
> * domains. Convert them to ratios by scaling against
> - * globally available memory.
> + * globally available memory. As the ratios are in
> + * per-PAGE_SIZE, they can be obtained by dividing bytes by
> + * pages.

The comment would be more comprehensible to me is the last sentence was
"... by dividing bytes by number of pages".

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR