Skip to contentSkip to conversation

memcg: set soft_limit_in_bytes to 0 by default

PATCH Superseded Ying Han 5 participants 7 messages Apr 11, 2012 – Apr 16, 2012 Memory management

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Ying Han

author
#0 lore raw

PATCH v2 3/5 memcg: set soft_limit_in_bytes to 0 by default

1. If soft_limit are all set to MAX, it wastes first three periority iterations without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also set the value to MAX for special memcg which is immune to soft limit reclaim.

This idea is based on discussion with Michal and Johannes from LSF.

---
 kernel/res_counter.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/res_counter.c +0 -1
index d508363..8017d01 100644
@@ -18,7 +18,6 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent)
 {
 	spin_lock_init(&counter->lock);
 	counter->limit = RESOURCE_MAX;
-	counter->soft_limit = RESOURCE_MAX;
 	counter->parent = parent;
 }
 
Signature · 8 lines
1.7.7.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 7 lines · Ying Han

1. If soft_limit are all set to MAX, it wastes first three periority iterations without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also set the value to MAX for special memcg which is immune to soft limit reclaim.

This idea is based on discussion with Michal and Johannes from LSF.

Combined with patch 2/5, would this not result in always returning "reclaim from this memcg" for groups without a configured softlimit, while groups with a configured softlimit only get reclaimed from when they are over their limit?

Is that the desired behaviour when a system has some cgroups with a configured softlimit, and some without?

Signature · 8 lines
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw
Quoted 9 lines · Rik van Riel
Quoted 7 lines · Ying Han

1. If soft_limit are all set to MAX, it wastes first three periority iterations without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also set the value to MAX for special memcg which is immune to soft limit reclaim.

This idea is based on discussion with Michal and Johannes from LSF.

Quoted 8 lines

Combined with patch 2/5, would this not result in always returning "reclaim from this memcg" for groups without a configured softlimit, while groups with a configured softlimit only get reclaimed from when they are over their limit?

Is that the desired behaviour when a system has some cgroups with a configured softlimit, and some without?

Yes, in general I think this new behaviour is welcome.

In the past, soft limits were only used to give excess memory a lower priority and there was no particular meaning associated with "being below your soft limit". This change makes it so that soft limits are actually a minimum guarantee, too, so you wouldn't get reclaimed if you behaved (if possible):

A-unconfigured B-below-softlimit
old: reclaim reclaim
new: reclaim no reclaim (if possible)

The much less obvious change here, however, is that we no longer put extra pressure on groups above their limit compared to unconfigured groups:

A-unconfigured B-above-softlimit
old: reclaim reclaim twice
new: reclaim reclaim

I still think that it's a reasonable use case to put a soft limit on a workload to "nice" it memory-wise, without looking at the machine as a whole and configuring EVERY cgroup based on global knowledge and static partitioning of the machine.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#5 lore raw
In reply to Rik van Riel
Quoted 14 lines · Rik van Riel
Quoted 11 lines · Ying Han

1. If soft_limit are all set to MAX, it wastes first three periority iterations
without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also
set the value to MAX for special memcg which is immune to soft limit reclaim.

This idea is based on discussion with Michal and Johannes from LSF.

Quoted 8 lines

Combined with patch 2/5, would this not result in always returning "reclaim from this memcg" for groups without a configured softlimit, while groups with a configured softlimit only get reclaimed from when they are over their limit?

Is that the desired behaviour when a system has some cgroups with a configured softlimit, and some without?

That is expected behavior. Basically after this change, by default all memcgs are eligible for reclaim under global memory pressure. Only those memcgs who sets their softlimit will be skipped if usage less than softlimit.

Does it answer your question? I might misunderstood.

--Ying

Quoted 2 lines

--
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
In reply to Ying Han
Quoted 1 line · Ying Han

1. If soft_limit are all set to MAX, it wastes first three periority iterations

s/periority/priority/

Quoted 3 lines

without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also

s/eligibal/eligible/

Quoted 2 lines

set the value to MAX for special memcg which is immune to soft limit reclaim.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
In reply to Johannes Weiner
Quoted 31 lines · Johannes Weiner
Quoted 9 lines · Rik van Riel
Quoted 7 lines · Ying Han

1. If soft_limit are all set to MAX, it wastes first three periority iterations without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also set the value to MAX for special memcg which is immune to soft limit reclaim.

This idea is based on discussion with Michal and Johannes from LSF.

Quoted 8 lines

Combined with patch 2/5, would this not result in always returning "reclaim from this memcg" for groups without a configured softlimit, while groups with a configured softlimit only get reclaimed from when they are over their limit?

Is that the desired behaviour when a system has some cgroups with a configured softlimit, and some without?

Yes, in general I think this new behaviour is welcome.

In the past, soft limits were only used to give excess memory a lower priority and there was no particular meaning associated with "being below your soft limit". This change makes it so that soft limits are actually a minimum guarantee, too, so you wouldn't get reclaimed if you behaved (if possible):

A-unconfigured B-below-softlimit
old: reclaim reclaim
new: reclaim no reclaim (if possible)

Quoted 7 lines

The much less obvious change here, however, is that we no longer put extra pressure on groups above their limit compared to unconfigured groups:

A-unconfigured B-above-softlimit
old: reclaim reclaim twice
new: reclaim reclaim

Agreed and I guess that the above should be a part of the changelog. This is changing previous behavior and we should rather be explicit about that.

Quoted 4 lines

I still think that it's a reasonable use case to put a soft limit on a workload to "nice" it memory-wise, without looking at the machine as a whole and configuring EVERY cgroup based on global knowledge and static partitioning of the machine.

Signature · 13 lines
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#4 lore raw
Quoted 36 lines · Michal Hocko
Quoted 35 lines · Johannes Weiner
Quoted 9 lines · Rik van Riel
Quoted 7 lines · Ying Han

1. If soft_limit are all set to MAX, it wastes first three periority iterations without scanning anything.

2. By default every memcg is eligibal for softlimit reclaim, and we can also set the value to MAX for special memcg which is immune to soft limit reclaim.

This idea is based on discussion with Michal and Johannes from LSF.

Quoted 8 lines

Combined with patch 2/5, would this not result in always returning "reclaim from this memcg" for groups without a configured softlimit, while groups with a configured softlimit only get reclaimed from when they are over their limit?

Is that the desired behaviour when a system has some cgroups with a configured softlimit, and some without?

Yes, in general I think this new behaviour is welcome.

In the past, soft limits were only used to give excess memory a lower priority and there was no particular meaning associated with "being below your soft limit".  This change makes it so that soft limits are actually a minimum guarantee, too, so you wouldn't get reclaimed if you behaved (if possible):

              A-unconfigured          B-below-softlimit
old:          reclaim                 reclaim
new:          reclaim                 no reclaim (if possible)

The much less obvious change here, however, is that we no longer put extra pressure on groups above their limit compared to unconfigured groups:

Quoted 7 lines
Quoted 3 lines

              A-unconfigured          B-above-softlimit
old:          reclaim                 reclaim twice
new:          reclaim                 reclaim

Agreed and I guess that the above should be a part of the changelog. This is changing previous behavior and we should rather be explicit about that.

Ok, I will include it on next post.

Thanks !

--Ying

Quoted 6 lines
Quoted 5 lines

I still think that it's a reasonable use case to put a soft limit on a workload to "nice" it memory-wise, without looking at the machine as a whole and configuring EVERY cgroup based on global knowledge and static partitioning of the machine.

Quoted 7 lines

--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>