Re: [PATCH v6 20/29] memcg: skip memcg kmem allocations inspecified code regions

From: Andrew Morton
Date: Mon Nov 05 2012 - 19:33:04 EST


On Thu, 1 Nov 2012 16:07:36 +0400
Glauber Costa <glommer@xxxxxxxxxxxxx> wrote:

> This patch creates a mechanism that skip memcg allocations during
> certain pieces of our core code. It basically works in the same way
> as preempt_disable()/preempt_enable(): By marking a region under
> which all allocations will be accounted to the root memcg.
>
> We need this to prevent races in early cache creation, when we
> allocate data using caches that are not necessarily created already.
>
> ...
>
> +static inline void memcg_stop_kmem_account(void)
> +{
> + if (!current->mm)
> + return;

It is utterly unobvious to this reader why the code tests ->mm in this
fashion. So we need either smarter readers or a code comment.

--
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/