diff mbox series

[-next] mm/memcontrol.c: replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled()

Message ID 20220625061844.226764-1-xiangyang3@huawei.com (mailing list archive)
State New
Headers show
Series [-next] mm/memcontrol.c: replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled() | expand

Commit Message

Xiang Yang June 25, 2022, 6:18 a.m. UTC
mem_cgroup_kmem_disabled() checks whether the kmem accounting is off.
Therefore, replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled(),
which is the same work in percpu.c and slab_common.c.

Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
---
 mm/memcontrol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Muchun Song June 25, 2022, 8:58 a.m. UTC | #1
On Sat, Jun 25, 2022 at 02:18:44PM +0800, Xiang Yang wrote:
> mem_cgroup_kmem_disabled() checks whether the kmem accounting is off.
> Therefore, replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled(),
> which is the same work in percpu.c and slab_common.c.
> 
> Signed-off-by: Xiang Yang <xiangyang3@huawei.com>

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

Thanks.
Roman Gushchin June 26, 2022, 1:41 a.m. UTC | #2
On Sat, Jun 25, 2022 at 02:18:44PM +0800, Xiang Yang wrote:
> mem_cgroup_kmem_disabled() checks whether the kmem accounting is off.
> Therefore, replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled(),
> which is the same work in percpu.c and slab_common.c.
> 
> Signed-off-by: Xiang Yang <xiangyang3@huawei.com>

Acked-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!
Souptick Joarder June 27, 2022, 1:05 a.m. UTC | #3
On Sat, Jun 25, 2022 at 11:51 AM Xiang Yang <xiangyang3@huawei.com> wrote:
>
> mem_cgroup_kmem_disabled() checks whether the kmem accounting is off.
> Therefore, replace cgroup_memory_nokmem with mem_cgroup_kmem_disabled(),
> which is the same work in percpu.c and slab_common.c.
>
> Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
Acked-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
> ---
>  mm/memcontrol.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 85adc43c5a25..4672c9ddd188 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3815,7 +3815,7 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,
>  #ifdef CONFIG_MEMCG_KMEM
>  static int memcg_online_kmem(struct mem_cgroup *memcg)
>  {
> -       if (cgroup_memory_nokmem)
> +       if (mem_cgroup_kmem_disabled())
>                 return 0;
>
>         if (unlikely(mem_cgroup_is_root(memcg)))
> @@ -3830,7 +3830,7 @@ static int memcg_online_kmem(struct mem_cgroup *memcg)
>
>  static void memcg_offline_kmem(struct mem_cgroup *memcg)
>  {
> -       if (cgroup_memory_nokmem)
> +       if (mem_cgroup_kmem_disabled())
>                 return;
>
>         if (unlikely(mem_cgroup_is_root(memcg)))
> --
> 2.22.0
>
>
diff mbox series

Patch

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 85adc43c5a25..4672c9ddd188 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3815,7 +3815,7 @@  static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,
 #ifdef CONFIG_MEMCG_KMEM
 static int memcg_online_kmem(struct mem_cgroup *memcg)
 {
-	if (cgroup_memory_nokmem)
+	if (mem_cgroup_kmem_disabled())
 		return 0;
 
 	if (unlikely(mem_cgroup_is_root(memcg)))
@@ -3830,7 +3830,7 @@  static int memcg_online_kmem(struct mem_cgroup *memcg)
 
 static void memcg_offline_kmem(struct mem_cgroup *memcg)
 {
-	if (cgroup_memory_nokmem)
+	if (mem_cgroup_kmem_disabled())
 		return;
 
 	if (unlikely(mem_cgroup_is_root(memcg)))