Re: [PATCH] mm: memcg: remove direct use of __memcg_kmem_uncharge_page

Muchun Song
2023-12-13T14:27:29Z

> On Dec 13, 2023, at 21:04, Yosry Ahmed <yosryahmed@google.com> wrote:
>
> memcg_kmem_uncharge_page() is an inline wrapper around
> __memcg_kmem_uncharge_page() that checks memcg_kmem_online() before
> making the function call. Internally, __memcg_kmem_uncharge_page() has a
> folio_memcg_kmem() check.
>
> The only direct user of __memcg_kmem_uncharge_page(),
> free_pages_prepare(), checks PageMemcgKmem() before calling it to avoid
> the function call if possible. Move the folio_memcg_kmem() check from
> __memcg_kmem_uncharge_page() to memcg_kmem_uncharge_page() as
> PageMemcgKmem() -- which does the same thing under the hood. Now
> free_pages_prepare() can also use memcg_kmem_uncharge_page().
>
> No functional change intended.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@google.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks