Re: [PATCH V4 02/15] blk-throttle: add .high interface

From: Tejun Heo
Date: Tue Nov 22 2016 - 15:02:59 EST


Hello, Shaohua.

Sorry about the delay.

On Mon, Nov 14, 2016 at 02:22:09PM -0800, Shaohua Li wrote:
> @@ -1376,11 +1414,37 @@ static ssize_t tg_set_max(struct kernfs_open_file *of,
> goto out_finish;
> }
>
> - tg->bps[READ][LIMIT_MAX] = v[0];
> - tg->bps[WRITE][LIMIT_MAX] = v[1];
> - tg->iops[READ][LIMIT_MAX] = v[2];
> - tg->iops[WRITE][LIMIT_MAX] = v[3];
> -
> + if (index == LIMIT_MAX) {
> + if ((v[0] < tg->bps[READ][LIMIT_HIGH] &&
> + tg->bps[READ][LIMIT_HIGH] != -1) ||
> + (v[1] < tg->bps[WRITE][LIMIT_HIGH] &&
> + tg->bps[WRITE][LIMIT_HIGH] != -1) ||
> + (v[2] < tg->iops[READ][LIMIT_HIGH] &&
> + tg->iops[READ][LIMIT_HIGH] != -1) ||
> + (v[3] < tg->iops[WRITE][LIMIT_HIGH] &&
> + tg->iops[WRITE][LIMIT_HIGH] != -1)) {
> + ret = -EINVAL;
> + goto out_finish;

Is this necessary? memcg doesn't put restrictions on input but just
enforces whatever is configured. I think it'd be better to follow the
same model here too. Hmm... is this because throtl will be able to
choose either all high or max limits per cgroup?

And this isn't from your patches but can we please switch to
UINT64_MAX instead of -1?

> + }
> + } else if (index == LIMIT_HIGH) {
> + if ((v[0] > tg->bps[READ][LIMIT_MAX] && v[0] != -1) ||
> + (v[1] > tg->bps[WRITE][LIMIT_MAX] && v[1] != -1) ||
> + (v[2] > tg->iops[READ][LIMIT_MAX] && v[2] != -1) ||
> + (v[3] > tg->iops[WRITE][LIMIT_MAX] && v[3] != -1)) {

Ditto here.

> @@ -1412,6 +1484,7 @@ static struct blkcg_policy blkcg_policy_throtl = {
> .pd_alloc_fn = throtl_pd_alloc,
> .pd_init_fn = throtl_pd_init,
> .pd_online_fn = throtl_pd_online,
> + .pd_offline_fn = throtl_pd_offline,
> .pd_free_fn = throtl_pd_free,
> };

I haven't read the whole thing yet but this looks a bit suspicious. A
css going offline indicates that the destruction of the css started.
I don't get why that'd reset high limits. There can be a lot of async
IOs after offline.

Thanks.

--
tejun