lkml.org 
[lkml]   [2012]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 06/29] memcg: kmem controller infrastructure
On Thu, 1 Nov 2012, Glauber Costa wrote:

> +#ifdef CONFIG_MEMCG_KMEM
> +static inline bool memcg_kmem_enabled(void)
> +{
> + return true;
> +}
> +

Maybe it would be better to do this in the same way that NUMA_BUILD was
done in kernel.h?


> +static __always_inline bool
> +memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
> +{
> + if (!memcg_kmem_enabled())
> + return true;
> +
> + /*
> + * __GFP_NOFAIL allocations will move on even if charging is not
> + * possible. Therefore we don't even try, and have this allocation
> + * unaccounted. We could in theory charge it with
> + * res_counter_charge_nofail, but we hope those allocations are rare,
> + * and won't be worth the trouble.
> + */
> + if (!(gfp & __GFP_KMEMCG) || (gfp & __GFP_NOFAIL))
> + return true;


> + if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
> + return true;

This type of check is repeatedly occurring in various subsystems. Could we
get a function (maybe inline) to do this check?



\
 
 \ /
  Last update: 2012-11-01 21:21    [W:0.661 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site