linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] LMK: Optimize lowmem_shrink
@ 2013-08-20  1:16 Leon Ma
  2013-08-20  2:23 ` Colin Cross
  2013-08-20  8:30 ` Dan Carpenter
  0 siblings, 2 replies; 8+ messages in thread
From: Leon Ma @ 2013-08-20  1:16 UTC (permalink / raw)
  To: gregkh, ccross, devel, linux-kernel

From: Leon Ma <xindong.ma@intel.com>
Date: Mon, 19 Aug 2013 14:22:38 +0800
Subject: [PATCH] LMK: Optimize lowmem_shrink.

By comparing with selected_oom_score_adj instead of min_score_adj,
we may do less calculation.

Signed-off-by: Leon Ma <xindong.ma@intel.com>
---
 drivers/staging/android/lowmemorykiller.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c
b/drivers/staging/android/lowmemorykiller.c
index f6c05c9..cb944c5 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -126,7 +126,7 @@ static int lowmem_shrink(struct shrinker *s, struct
shrink_control *sc)
 			return 0;
 		}
 		oom_score_adj = p->signal->oom_score_adj;
-		if (oom_score_adj < min_score_adj) {
+		if (oom_score_adj < selected_oom_score_adj) {
 			task_unlock(p);
 			continue;
 		}
@@ -134,13 +134,9 @@ static int lowmem_shrink(struct shrinker *s, struct
shrink_control *sc)
 		task_unlock(p);
 		if (tasksize <= 0)
 			continue;
-		if (selected) {
-			if (oom_score_adj < selected_oom_score_adj)
-				continue;
-			if (oom_score_adj == selected_oom_score_adj &&
-			    tasksize <= selected_tasksize)
-				continue;
-		}
+		if (selected && oom_score_adj == selected_oom_score_adj &&
+			tasksize <= selected_tasksize)
+			continue;
 		selected = p;
 		selected_tasksize = tasksize;
 		selected_oom_score_adj = oom_score_adj;
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] LMK: Optimize lowmem_shrink
@ 2013-08-21  1:41 Leon Ma
  2013-08-23 16:48 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Leon Ma @ 2013-08-21  1:41 UTC (permalink / raw)
  To: gregkh, ccross, devel, linux-kernel, dan.carpenter; +Cc: xindong.ma

From: Leon Ma <xindong.ma@intel.com>
Date: Mon, 19 Aug 2013 14:22:38 +0800
Subject: [PATCH] LMK: Optimize lowmem_shrink.

By comparing with selected_oom_score_adj instead of min_score_adj,
we may do less calculation.

Signed-off-by: Leon Ma <xindong.ma@intel.com>
---
 drivers/staging/android/lowmemorykiller.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index f6c05c9..cb944c5 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -126,7 +126,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
 			return 0;
 		}
 		oom_score_adj = p->signal->oom_score_adj;
-		if (oom_score_adj < min_score_adj) {
+		if (oom_score_adj < selected_oom_score_adj) {
 			task_unlock(p);
 			continue;
 		}
@@ -134,13 +134,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
 		task_unlock(p);
 		if (tasksize <= 0)
 			continue;
-		if (selected) {
-			if (oom_score_adj < selected_oom_score_adj)
-				continue;
-			if (oom_score_adj == selected_oom_score_adj &&
-			    tasksize <= selected_tasksize)
-				continue;
-		}
+		if (selected && oom_score_adj == selected_oom_score_adj &&
+			tasksize <= selected_tasksize)
+			continue;
 		selected = p;
 		selected_tasksize = tasksize;
 		selected_oom_score_adj = oom_score_adj;
-- 
1.7.4.1




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

end of thread, other threads:[~2013-08-23 21:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20  1:16 [PATCH] LMK: Optimize lowmem_shrink Leon Ma
2013-08-20  2:23 ` Colin Cross
2013-08-20  2:25   ` Colin Cross
2013-08-20  8:30 ` Dan Carpenter
2013-08-21  2:09   ` Ma, Xindong
  -- strict thread matches above, loose matches on Subject: below --
2013-08-21  1:41 Leon Ma
2013-08-23 16:48 ` Greg KH
2013-08-23 21:20   ` Sergey Senozhatsky

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