Re: [External] Re: [RFC PATCH v3 01/12] mm: memcontrol: move the objcg infrastructure out of CONFIG_MEMCG_KMEM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 26, 2021 at 12:27 AM Roman Gushchin <guro@xxxxxx> wrote:
>
> On Wed, Apr 21, 2021 at 03:00:48PM +0800, Muchun Song wrote:
> > Because memory allocations pinning memcgs for a long time - it exists
> > at a larger scale and is causing recurring problems in the real world:
> > page cache doesn't get reclaimed for a long time, or is used by the
> > second, third, fourth, ... instance of the same job that was restarted
> > into a new cgroup every time. Unreclaimable dying cgroups pile up,
> > waste memory, and make page reclaim very inefficient.
> >
> > We can convert LRU pages and most other raw memcg pins to the objcg
> > direction to fix this problem, and then the page->memcg will always
> > point to an object cgroup pointer.
> >
> > Therefore, the infrastructure of objcg no longer only serves
> > CONFIG_MEMCG_KMEM. In this patch, we move the infrastructure of the
> > objcg out of the scope of the CONFIG_MEMCG_KMEM so that the LRU pages
> > can reuse it to charge pages.
> >
> > We know that the LRU pages are not accounted at the root level. But
> > the page->memcg_data points to the root_mem_cgroup. So the
> > page->memcg_data of the LRU pages always points to a valid pointer.
> > But the root_mem_cgroup dose not have an object cgroup. If we use
> > obj_cgroup APIs to charge the LRU pages, we should set the
> > page->memcg_data to a root object cgroup. So we also allocate an
> > object cgroup for the root_mem_cgroup.
>
> Overall the patch looks very good to me. There are few small things to enhance:
>
> 1) I'd rename it. Looking at the title I expect a trivial code move,
>    however the patch is doing more than this: e.g. allocating an objcg
>    for the root memcg. Something like "prepare objcg API for non-kmem usage".

OK. I will rename it.

> 2) How about obj_cgroup_release_kmem() instead of obj_cgroup_release_uncharge()?

LGTM. Will use this name.

> 3) The first paragraph of the commit log looks a bit vague: which allocations
>    pinning memcgs? How about something like this?
>
> Pagecache pages are charged at the allocation time and holding a reference
> to the original memory cgroup until being reclaimed. Depending on the memory
> pressure, specific patterns of the page sharing between different cgroups and
> the cgroup creation and destruction rates, a large number of dying memory
> cgroups can be pinned by pagecache pages. It makes the page reclaim less
> efficient and wastes memory.

More clear. I would love to use this.

Thanks Roman.

>
>
> Thanks!




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux