Re: [PATCH mmotm] memcg: add interface to reset limits

From: Andrew Morton
Date: Fri Jun 05 2009 - 16:21:31 EST


On Fri, 5 Jun 2009 22:22:45 +0900
Daisuke Nishimura <d-nishimura@xxxxxxxxxxxxxxxxx> wrote:

> We don't have interface to reset mem.limit or memsw.limit now.
>
> This patch allows to reset mem.limit or memsw.limit when they are
> being set to -1.
>
> ...
>
> @@ -133,6 +133,16 @@ int res_counter_memparse_write_strategy(const char *buf,
> unsigned long long *res)
> {
> char *end;
> +
> + /* return RESOURCE_MAX(unlimited) if "-1" is specified */
> + if (*buf == '-') {
> + *res = simple_strtoull(buf + 1, &end, 10);
> + if (*res != 1 || *end != '\0')
> + return -EINVAL;
> + *res = RESOURCE_MAX;
> + return 0;
> + }

The test for (*end != '\0') would be unneeded if strict_strtoull() had
been used.


> +
> /* FIXME - make memparse() take const char* args */
> *res = memparse((char *)buf, &end);
> if (*end != '\0')
--
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/