Re: [PATCH 3/3] memcg: simplify and inline __mem_cgroup_from_kmem

From: Johannes Weiner
Date: Fri Oct 16 2015 - 18:20:10 EST


On Fri, Oct 16, 2015 at 03:12:23PM -0700, Hugh Dickins wrote:
> --- 4035m/mm/list_lru.c 2015-10-15 15:26:59.835572128 -0700
> +++ 4035M/mm/list_lru.c 2015-10-16 03:11:51.000000000 -0700
> @@ -63,6 +63,16 @@ list_lru_from_memcg_idx(struct list_lru_
> return &nlru->lru;
> }
>
> +static __always_inline struct mem_cgroup *mem_cgroup_from_kmem(void *ptr)
> +{
> + struct page *page;
> +
> + if (!memcg_kmem_enabled())
> + return NULL;
> + page = virt_to_head_page(ptr);
> + return page->mem_cgroup;
> +}
> +
> static inline struct list_lru_one *
> list_lru_from_kmem(struct list_lru_node *nlru, void *ptr)
> {

I like this better than the mm.h include, too.
--
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/