diff mbox series

[v2,1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller (fix)

Message ID 20230929181712.3723495-1-nphamcs@gmail.com (mailing list archive)
State New
Headers show
Series [v2,1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller (fix) | expand

Commit Message

Nhat Pham Sept. 29, 2023, 6:17 p.m. UTC
This fixlet disables the hugetlb memcg accounting behavior in cgroup v1.

Signed-off-by: Nhat Pham <nphamcs@gmail.com>
---
 mm/memcontrol.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Nhat Pham Sept. 29, 2023, 6:19 p.m. UTC | #1
On Fri, Sep 29, 2023 at 11:17 AM Nhat Pham <nphamcs@gmail.com> wrote:
>
> This fixlet disables the hugetlb memcg accounting behavior in cgroup v1.
>
Suggested-by: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Nhat Pham <nphamcs@gmail.com>
> ---
>  mm/memcontrol.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d5dfc9b36acb..de6bd8ca87f5 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -7081,6 +7081,7 @@ int mem_cgroup_hugetlb_charge_folio(struct folio *folio, gfp_t gfp)
>         int ret;
>
>         if (mem_cgroup_disabled() ||
> +               !cgroup_subsys_on_dfl(memory_cgrp_subsys) ||
>                 !(cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_HUGETLB_ACCOUNTING))
>                 return 0;
>
> --
> 2.34.1
diff mbox series

Patch

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d5dfc9b36acb..de6bd8ca87f5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -7081,6 +7081,7 @@  int mem_cgroup_hugetlb_charge_folio(struct folio *folio, gfp_t gfp)
 	int ret;
 
 	if (mem_cgroup_disabled() ||
+		!cgroup_subsys_on_dfl(memory_cgrp_subsys) ||
 		!(cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_HUGETLB_ACCOUNTING))
 		return 0;