Skip to contentSkip to conversation

mm: memcg set soft_limit_in_bytes to 0 by default

PATCH In review Ying Han 2 participants 2 messages Jun 6, 2012 – Jun 18, 2012 Memory management

lore
Share & tools
lore

Ying Han

author
#0 lore raw

PATCH 2/5 mm: memcg set soft_limit_in_bytes to 0 by default

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

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

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

There is a behavior change after this patch: (N == DEF_PRIORITY - 2)

        A: usage > softlimit        B: usage <= softlimit        U: softlimit unset
old:    reclaim at each priority    reclaim when priority < N    reclaim when priority < N
new:    reclaim at each priority    reclaim when priority < N    reclaim at each priority

Note: I can leave the counter->soft_limit uninitialized, at least all the caller of res_counter_init() have the memcg as pre-zeroed structure. However, I might be better not rely on that.

---
 kernel/res_counter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/res_counter.c +1 -1
index d508363..231c7ef 100644
@@ -18,7 +18,7 @@ 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->soft_limit = 0;
 	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>
Acked-by on v1 2/5
#1 lore raw
Quoted 14 lines · Ying Han

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

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

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

There is a behavior change after this patch: (N == DEF_PRIORITY - 2)

         A: usage>  softlimit        B: usage<= softlimit        U: softlimit unset
old:    reclaim at each priority    reclaim when priority<  N    reclaim when priority<  N
new:    reclaim at each priority    reclaim when priority<  N    reclaim at each priority
Quoted 5 lines

Note: I can leave the counter->soft_limit uninitialized, at least all the caller of res_counter_init() have the memcg as pre-zeroed structure. However, I might be better not rely on that.

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>