summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/memcontrol.c4
-rw-r--r--mm/page_counter.c12
2 files changed, 3 insertions, 13 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e6043ab3017c..43bd549cf3f5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6266,9 +6266,7 @@ struct cgroup_subsys memory_cgrp_subsys = {
* elow = min( memory.low, parent->elow * ------------------ ),
* siblings_low_usage
*
- * | memory.current, if memory.current < memory.low
- * low_usage = |
- * | 0, otherwise.
+ * low_usage = min(memory.low, memory.current)
*
*
* Such definition of the effective memory.low provides the expected
diff --git a/mm/page_counter.c b/mm/page_counter.c
index de31470655f6..75d53f15f040 100644
--- a/mm/page_counter.c
+++ b/mm/page_counter.c
@@ -23,11 +23,7 @@ static void propagate_protected_usage(struct page_counter *c,
return;
if (c->min || atomic_long_read(&c->min_usage)) {
- if (usage <= c->min)
- protected = usage;
- else
- protected = 0;
-
+ protected = min(usage, c->min);
old_protected = atomic_long_xchg(&c->min_usage, protected);
delta = protected - old_protected;
if (delta)
@@ -35,11 +31,7 @@ static void propagate_protected_usage(struct page_counter *c,
}
if (c->low || atomic_long_read(&c->low_usage)) {
- if (usage <= c->low)
- protected = usage;
- else
- protected = 0;
-
+ protected = min(usage, c->low);
old_protected = atomic_long_xchg(&c->low_usage, protected);
delta = protected - old_protected;
if (delta)