linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: "Arve Hjønnevåg" <arve@android.com>,
	"Android Kernel Team" <kernel-team@android.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"John Stultz" <john.stultz@linaro.org>
Subject: [PATCH 2/5] staging: android: lowmemorykiller: Don't count reserved free memory
Date: Tue, 26 Feb 2013 22:07:35 -0800	[thread overview]
Message-ID: <1361945258-24420-3-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1361945258-24420-1-git-send-email-john.stultz@linaro.org>

From: Arve Hjønnevåg <arve@android.com>

The amount of reserved memory varies between devices. Subtract it
here to reduce the amount of devices specific tuning needed for the
minfree values.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/staging/android/lowmemorykiller.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 7e00bdb..2f28763 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -35,6 +35,7 @@
 #include <linux/mm.h>
 #include <linux/oom.h>
 #include <linux/sched.h>
+#include <linux/swap.h>
 #include <linux/rcupdate.h>
 #include <linux/profile.h>
 #include <linux/notifier.h>
@@ -74,7 +75,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
 	int selected_tasksize = 0;
 	short selected_oom_score_adj;
 	int array_size = ARRAY_SIZE(lowmem_adj);
-	int other_free = global_page_state(NR_FREE_PAGES);
+	int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages;
 	int other_file = global_page_state(NR_FILE_PAGES) -
 						global_page_state(NR_SHMEM);
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-02-27  6:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27  6:07 [PATCH 0/5] staging: Updates from the Android tree (for 3.10) John Stultz
2013-02-27  6:07 ` [PATCH 1/5] staging: android: lowmemorykiller: Add config option to support oom_adj values John Stultz
2013-02-27 22:18   ` David Rientjes
2013-02-27 22:38     ` Arve Hjønnevåg
2013-02-27 23:12       ` David Rientjes
2013-02-27 23:47         ` Arve Hjønnevåg
2013-02-28  0:14           ` David Rientjes
2013-02-28  1:05             ` Arve Hjønnevåg
2013-02-28  1:41               ` David Rientjes
2013-02-27  6:07 ` John Stultz [this message]
2013-02-27 22:19   ` [PATCH 2/5] staging: android: lowmemorykiller: Don't count reserved free memory David Rientjes
2013-02-27  6:07 ` [PATCH 3/5] staging: android: lowmemorykiller: Change default debug_level to 1 John Stultz
2013-02-27  6:07 ` [PATCH 4/5] staging: android: logger: Allow a UID to read it's own log entries John Stultz
2013-02-27  6:07 ` [PATCH 5/5] staging: android: logger: enforce GID and CAP check on log flush John Stultz
2013-03-05  8:39 ` [PATCH 0/5] staging: Updates from the Android tree (for 3.10) Greg Kroah-Hartman
2013-03-05  9:56   ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361945258-24420-3-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=arve@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).