linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mm/memcg: Fix min/low usage in propagate_protected_usage()
@ 2018-12-03  8:01 Xunlei Pang
  2018-12-03  8:01 ` [PATCH 2/3] mm/vmscan: Enable kswapd to reclaim low-protected memory Xunlei Pang
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Xunlei Pang @ 2018-12-03  8:01 UTC (permalink / raw)
  To: Michal Hocko, Roman Gushchin, Johannes Weiner; +Cc: linux-kernel, linux-mm

When usage exceeds min, min usage should be min other than 0.
Apply the same for low.

Signed-off-by: Xunlei Pang <xlpang@linux.alibaba.com>
---
 mm/page_counter.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

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)
-- 
2.13.5 (Apple Git-94)


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

end of thread, other threads:[~2018-12-05 23:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03  8:01 [PATCH 1/3] mm/memcg: Fix min/low usage in propagate_protected_usage() Xunlei Pang
2018-12-03  8:01 ` [PATCH 2/3] mm/vmscan: Enable kswapd to reclaim low-protected memory Xunlei Pang
2018-12-03 11:56   ` Michal Hocko
2018-12-03 15:20     ` Xunlei Pang
2018-12-03 17:22       ` Michal Hocko
2018-12-04  2:40         ` Xunlei Pang
2018-12-04  7:25           ` Michal Hocko
2018-12-04  8:44             ` Xunlei Pang
2018-12-03  8:01 ` [PATCH 3/3] mm/memcg: Avoid reclaiming below hard protection Xunlei Pang
2018-12-03 11:57   ` Michal Hocko
2018-12-04  2:53     ` Xunlei Pang
2018-12-03 11:54 ` [PATCH 1/3] mm/memcg: Fix min/low usage in propagate_protected_usage() Michal Hocko
2018-12-03 14:49   ` Xunlei Pang
2018-12-03 18:00 ` Roman Gushchin
2018-12-05  8:58   ` Xunlei Pang
2018-12-05 23:11     ` Roman Gushchin

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).