Re: [PATCH 7/10] mm/memcg: remove mem_cgroup_reset_owner

From: KAMEZAWA Hiroyuki
Date: Tue Feb 21 2012 - 04:18:58 EST


On Mon, 20 Feb 2012 15:35:38 -0800 (PST)
Hugh Dickins <hughd@xxxxxxxxxx> wrote:

> With mem_cgroup_reset_uncharged_to_root() now making sure that freed
> pages point to root_mem_cgroup (instead of to a stale and perhaps
> long-deleted memcg), we no longer need to initialize page memcg to
> root in those odd places which put a page on lru before charging.
> Delete mem_cgroup_reset_owner().
>
> But: we have no init_page_cgroup() nowadays (and even when we had,
> it was called before root_mem_cgroup had been allocated); so until
> a struct page has once entered the memcg lru cycle, its page_cgroup
> ->mem_cgroup will be NULL instead of root_mem_cgroup.
>
> That could be fixed by reintroducing init_page_cgroup(), and ordering
> properly: in future we shall probably want root_mem_cgroup in kernel
> bss or data like swapper_space; but let's not get into that right now.
>
> Instead allow for this in page_relock_lruvec(): treating NULL as
> root_mem_cgroup, and correcting pc->mem_cgroup before going further.
>
> What? Before even taking the zone->lru_lock? Is that safe?
> Yes, because compaction and lumpy reclaim use __isolate_lru_page(),
> which refuses unless it sees PageLRU - which may be cleared at any
> instant, but we only need it to have been set once in the past for
> pc->mem_cgroup to be initialized properly.
>
> Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>

Ok, this seems to be much better than current reset_owner().

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

Thanks,
-Kame


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