Thread (10 messages) 10 messages, 5 authors, 2022-01-03

Re: [PATCH v2] memcg: add per-memcg vmalloc stat

From: Shakeel Butt <hidden>
Date: 2021-12-30 19:06:31
Also in: lkml

Hi Michal,

On Mon, Dec 27, 2021 at 2:48 AM Michal Hocko [off-list ref] wrote:
[...]
quoted
      atomic_long_add(area->nr_pages, &nr_vmalloc_pages);
+     mod_memcg_page_state(area->pages[0], MEMCG_VMALLOC, area->nr_pages);

      /*
       * If not enough pages were obtained to accomplish an
Is it safe to assume that the whole area is always charged to the same
memcg? I am not really deeply familiar with vmalloc internals but is it
possible that an area could get resized/partially reused with a
different charging context?
From what I understand, vmalloc areas are not resized or partially
reused at the moment. There is some ongoing discussion on caching it
but caching would also require updating the accounting part as well.

Regarding the whole area charged to the same memcg, the only way it
may get charged to different memcgs is if the process in which the
allocations are happening is migrated to a different memcg. We can
resolve this by traversing the pages in area->pages array (and use
lruvec based stats instead).

I did contemplate on making this a lruvec stat but decided to start
simple and if we ever need per-node stat then we can easily move to
lruvec based stats. Let me know what you think.

thanks,
Shakeel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help