lkml.org 
[lkml]   [2012]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 20/29] memcg: skip memcg kmem allocations in specified code regions
On Thu,  1 Nov 2012 16:07:36 +0400
Glauber Costa <glommer@parallels.com> 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.



\
 
 \ /
  Last update: 2012-11-06 02:22    [W:0.019 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site