linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memcg: non-hierarchical mode is deprecated
@ 2022-04-03  2:08 Wei Yang
  2022-04-04  9:27 ` Michal Hocko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Wei Yang @ 2022-04-03  2:08 UTC (permalink / raw)
  To: akpm; +Cc: cgroups, linux-mm, Wei Yang, Roman Gushchin, Johannes Weiner

After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
mode"), we won't have a NULL parent except root_mem_cgroup. And this
case is handled when (memcg == root).

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Roman Gushchin <roman.gushchin@linux.dev>
CC: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/memcontrol.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2cd8bfdec379..3ceb9b8592b1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6587,9 +6587,6 @@ void mem_cgroup_calculate_protection(struct mem_cgroup *root,
 		return;
 
 	parent = parent_mem_cgroup(memcg);
-	/* No parent means a non-hierarchical mode on v1 memcg */
-	if (!parent)
-		return;
 
 	if (parent == root) {
 		memcg->memory.emin = READ_ONCE(memcg->memory.min);
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/memcg: non-hierarchical mode is deprecated
  2022-04-03  2:08 [PATCH] mm/memcg: non-hierarchical mode is deprecated Wei Yang
@ 2022-04-04  9:27 ` Michal Hocko
  2022-04-05  2:22   ` Wei Yang
  2022-04-04 19:11 ` Roman Gushchin
  2022-04-05 18:20 ` Shakeel Butt
  2 siblings, 1 reply; 7+ messages in thread
From: Michal Hocko @ 2022-04-04  9:27 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, cgroups, linux-mm, Roman Gushchin, Johannes Weiner

On Sun 03-04-22 02:08:33, Wei Yang wrote:
> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
> mode"), we won't have a NULL parent except root_mem_cgroup. And this
> case is handled when (memcg == root).
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Roman Gushchin <roman.gushchin@linux.dev>
> CC: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!

> ---
>  mm/memcontrol.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 2cd8bfdec379..3ceb9b8592b1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6587,9 +6587,6 @@ void mem_cgroup_calculate_protection(struct mem_cgroup *root,
>  		return;
>  
>  	parent = parent_mem_cgroup(memcg);
> -	/* No parent means a non-hierarchical mode on v1 memcg */
> -	if (!parent)
> -		return;
>  
>  	if (parent == root) {
>  		memcg->memory.emin = READ_ONCE(memcg->memory.min);
> -- 
> 2.33.1

-- 
Michal Hocko
SUSE Labs


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/memcg: non-hierarchical mode is deprecated
  2022-04-03  2:08 [PATCH] mm/memcg: non-hierarchical mode is deprecated Wei Yang
  2022-04-04  9:27 ` Michal Hocko
@ 2022-04-04 19:11 ` Roman Gushchin
  2022-04-05 18:20 ` Shakeel Butt
  2 siblings, 0 replies; 7+ messages in thread
From: Roman Gushchin @ 2022-04-04 19:11 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, cgroups, linux-mm, Johannes Weiner

On Sun, Apr 03, 2022 at 02:08:33AM +0000, Wei Yang wrote:
> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
> mode"), we won't have a NULL parent except root_mem_cgroup. And this
> case is handled when (memcg == root).
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Roman Gushchin <roman.gushchin@linux.dev>
> CC: Johannes Weiner <hannes@cmpxchg.org>

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

Thanks!

> ---
>  mm/memcontrol.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 2cd8bfdec379..3ceb9b8592b1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6587,9 +6587,6 @@ void mem_cgroup_calculate_protection(struct mem_cgroup *root,
>  		return;
>  
>  	parent = parent_mem_cgroup(memcg);
> -	/* No parent means a non-hierarchical mode on v1 memcg */
> -	if (!parent)
> -		return;
>  
>  	if (parent == root) {
>  		memcg->memory.emin = READ_ONCE(memcg->memory.min);
> -- 
> 2.33.1
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/memcg: non-hierarchical mode is deprecated
  2022-04-04  9:27 ` Michal Hocko
@ 2022-04-05  2:22   ` Wei Yang
  2022-04-05  6:26     ` Michal Hocko
  0 siblings, 1 reply; 7+ messages in thread
From: Wei Yang @ 2022-04-05  2:22 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Wei Yang, akpm, cgroups, linux-mm, Roman Gushchin, Johannes Weiner

On Mon, Apr 04, 2022 at 11:27:53AM +0200, Michal Hocko wrote:
>On Sun 03-04-22 02:08:33, Wei Yang wrote:
>> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
>> mode"), we won't have a NULL parent except root_mem_cgroup. And this
>> case is handled when (memcg == root).
>> 
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> CC: Roman Gushchin <roman.gushchin@linux.dev>
>> CC: Johannes Weiner <hannes@cmpxchg.org>
>
>Acked-by: Michal Hocko <mhocko@suse.com>
>Thanks!
>

Thanks for the ack. When reading the code, I found one redundant check in
shrink_node_memcgs().

  shrink_node_memcgs
    mem_cgroup_below_min
      mem_cgroup_supports_protection
    mem_cgroup_below_low
      mem_cgroup_supports_protection

I am not sure it worthwhile to take it out.

  shrink_node_memcgs
    mem_cgroup_supports_protection
      mem_cgroup_below_min
      mem_cgroup_below_low

Look forward your opinion.

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/memcg: non-hierarchical mode is deprecated
  2022-04-05  2:22   ` Wei Yang
@ 2022-04-05  6:26     ` Michal Hocko
  2022-04-05  8:05       ` Wei Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Hocko @ 2022-04-05  6:26 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, cgroups, linux-mm, Roman Gushchin, Johannes Weiner

On Tue 05-04-22 02:22:18, Wei Yang wrote:
> On Mon, Apr 04, 2022 at 11:27:53AM +0200, Michal Hocko wrote:
> >On Sun 03-04-22 02:08:33, Wei Yang wrote:
> >> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
> >> mode"), we won't have a NULL parent except root_mem_cgroup. And this
> >> case is handled when (memcg == root).
> >> 
> >> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> >> CC: Roman Gushchin <roman.gushchin@linux.dev>
> >> CC: Johannes Weiner <hannes@cmpxchg.org>
> >
> >Acked-by: Michal Hocko <mhocko@suse.com>
> >Thanks!
> >
> 
> Thanks for the ack. When reading the code, I found one redundant check in
> shrink_node_memcgs().
> 
>   shrink_node_memcgs
>     mem_cgroup_below_min
>       mem_cgroup_supports_protection
>     mem_cgroup_below_low
>       mem_cgroup_supports_protection
> 
> I am not sure it worthwhile to take it out.
> 
>   shrink_node_memcgs
>     mem_cgroup_supports_protection
>       mem_cgroup_below_min
>       mem_cgroup_below_low
> 
> Look forward your opinion.

I guess you refer to mem_cgroup_is_root check in mem_cgroup_supports_protection,
right?

You are right that the check is not really required because e{min,low}
should always stay at 0 for the root memcg AFAICS. On the other hand the
check is not in any hot path and it really adds clarity here because
protection is not really supported on the root memcg. So I am not this
is an overall win.
-- 
Michal Hocko
SUSE Labs


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/memcg: non-hierarchical mode is deprecated
  2022-04-05  6:26     ` Michal Hocko
@ 2022-04-05  8:05       ` Wei Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2022-04-05  8:05 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Wei Yang, akpm, cgroups, linux-mm, Roman Gushchin, Johannes Weiner

On Tue, Apr 05, 2022 at 08:26:59AM +0200, Michal Hocko wrote:
>On Tue 05-04-22 02:22:18, Wei Yang wrote:
>> On Mon, Apr 04, 2022 at 11:27:53AM +0200, Michal Hocko wrote:
>> >On Sun 03-04-22 02:08:33, Wei Yang wrote:
>> >> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
>> >> mode"), we won't have a NULL parent except root_mem_cgroup. And this
>> >> case is handled when (memcg == root).
>> >> 
>> >> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> >> CC: Roman Gushchin <roman.gushchin@linux.dev>
>> >> CC: Johannes Weiner <hannes@cmpxchg.org>
>> >
>> >Acked-by: Michal Hocko <mhocko@suse.com>
>> >Thanks!
>> >
>> 
>> Thanks for the ack. When reading the code, I found one redundant check in
>> shrink_node_memcgs().
>> 
>>   shrink_node_memcgs
>>     mem_cgroup_below_min
>>       mem_cgroup_supports_protection
>>     mem_cgroup_below_low
>>       mem_cgroup_supports_protection
>> 
>> I am not sure it worthwhile to take it out.
>> 
>>   shrink_node_memcgs
>>     mem_cgroup_supports_protection
>>       mem_cgroup_below_min
>>       mem_cgroup_below_low
>> 
>> Look forward your opinion.
>
>I guess you refer to mem_cgroup_is_root check in mem_cgroup_supports_protection,
>right?
>
>You are right that the check is not really required because e{min,low}
>should always stay at 0 for the root memcg AFAICS. On the other hand the
>check is not in any hot path and it really adds clarity here because
>protection is not really supported on the root memcg. So I am not this
>is an overall win.

Agree.

>-- 
>Michal Hocko
>SUSE Labs

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/memcg: non-hierarchical mode is deprecated
  2022-04-03  2:08 [PATCH] mm/memcg: non-hierarchical mode is deprecated Wei Yang
  2022-04-04  9:27 ` Michal Hocko
  2022-04-04 19:11 ` Roman Gushchin
@ 2022-04-05 18:20 ` Shakeel Butt
  2 siblings, 0 replies; 7+ messages in thread
From: Shakeel Butt @ 2022-04-05 18:20 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, cgroups, linux-mm, Roman Gushchin, Johannes Weiner

On Sun, Apr 03, 2022 at 02:08:33AM +0000, Wei Yang wrote:
> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical
> mode"), we won't have a NULL parent except root_mem_cgroup. And this
> case is handled when (memcg == root).
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Roman Gushchin <roman.gushchin@linux.dev>
> CC: Johannes Weiner <hannes@cmpxchg.org>

Reviewed-by: Shakeel Butt <shakeelb@google.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-05 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-03  2:08 [PATCH] mm/memcg: non-hierarchical mode is deprecated Wei Yang
2022-04-04  9:27 ` Michal Hocko
2022-04-05  2:22   ` Wei Yang
2022-04-05  6:26     ` Michal Hocko
2022-04-05  8:05       ` Wei Yang
2022-04-04 19:11 ` Roman Gushchin
2022-04-05 18:20 ` Shakeel Butt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).