0a8e83a828310941810b98d4874ef7cd2dda6d91
[openwrt/svn-archive/archive.git] / target / linux / goldfish / patches-2.6.30 / 0053-lowmemorykiller-Don-t-count-free-space-unless-it-me.patch
1 From f82da10dcae73652a6f0355e4398b4be1af17e6b Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Mon, 26 Jan 2009 19:22:19 -0800
4 Subject: [PATCH 053/134] lowmemorykiller: Don't count free space unless it meets the specified limit by itself
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=utf-8
7 Content-Transfer-Encoding: 8bit
8
9 This allows processes to be killed when the kernel evict cache pages in
10 an attempt to get more contiguous free memory.
11
12 Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 ---
14 drivers/staging/android/lowmemorykiller.c | 13 +++++++++----
15 1 files changed, 9 insertions(+), 4 deletions(-)
16
17 diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
18 index b9a2e84..b2ab7fa 100644
19 --- a/drivers/staging/android/lowmemorykiller.c
20 +++ b/drivers/staging/android/lowmemorykiller.c
21 @@ -58,20 +58,25 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
22 int min_adj = OOM_ADJUST_MAX + 1;
23 int selected_tasksize = 0;
24 int array_size = ARRAY_SIZE(lowmem_adj);
25 - int other_free = global_page_state(NR_FREE_PAGES) + global_page_state(NR_FILE_PAGES);
26 + int other_free = global_page_state(NR_FREE_PAGES);
27 + int other_file = global_page_state(NR_FILE_PAGES);
28 if(lowmem_adj_size < array_size)
29 array_size = lowmem_adj_size;
30 if(lowmem_minfree_size < array_size)
31 array_size = lowmem_minfree_size;
32 for(i = 0; i < array_size; i++) {
33 - if(other_free < lowmem_minfree[i]) {
34 + if (other_free < lowmem_minfree[i] &&
35 + other_file < lowmem_minfree[i]) {
36 min_adj = lowmem_adj[i];
37 break;
38 }
39 }
40 if(nr_to_scan > 0)
41 - lowmem_print(3, "lowmem_shrink %d, %x, ofree %d, ma %d\n", nr_to_scan, gfp_mask, other_free, min_adj);
42 - rem = global_page_state(NR_ACTIVE) + global_page_state(NR_INACTIVE);
43 + lowmem_print(3, "lowmem_shrink %d, %x, ofree %d %d, ma %d\n", nr_to_scan, gfp_mask, other_free, other_file, min_adj);
44 + rem = global_page_state(NR_ACTIVE_ANON) +
45 + global_page_state(NR_ACTIVE_FILE) +
46 + global_page_state(NR_INACTIVE_ANON) +
47 + global_page_state(NR_INACTIVE_FILE);
48 if (nr_to_scan <= 0 || min_adj == OOM_ADJUST_MAX + 1) {
49 lowmem_print(5, "lowmem_shrink %d, %x, return %d\n", nr_to_scan, gfp_mask, rem);
50 return rem;
51 --
52 1.6.2
53