]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
lowmemorykiller: zram space available should be accounted
authorKrishna Reddy <vdumpa@nvidia.com>
Thu, 6 Mar 2014 23:25:27 +0000 (15:25 -0800)
committerKrishna Reddy <vdumpa@nvidia.com>
Mon, 10 Mar 2014 23:21:00 +0000 (16:21 -0700)
low memory killer should consider zram space available before
making low memory decisions.

Change-Id: I65cb7a0d417099508c72b2c9e82b00121644335a
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/378609

drivers/staging/android/lowmemorykiller.c

index 2c72aec6bb4cc80d55df13f6b915192d1491b6e7..eeac2918448d01ceb0971676a8c31fd53399aef1 100644 (file)
@@ -80,6 +80,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);
+       struct sysinfo swap_info;
        int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages
 #ifdef CONFIG_TEGRA_NVMAP
                         + nvmap_page_pool_get_unused_pages()
@@ -88,6 +89,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
        int other_file = global_page_state(NR_FILE_PAGES) -
                                                global_page_state(NR_SHMEM);
 
+       si_swapinfo(&swap_info);
+       other_free += swap_info.freeswap;
+
        if (lowmem_adj_size < array_size)
                array_size = lowmem_adj_size;
        if (lowmem_minfree_size < array_size)