diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 7310785a8ab..db9782da7e8 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -144,7 +144,8 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx, if (other_file != NULL) *other_file -= zone_page_state(zone, NR_FILE_PAGES) - - zone_page_state(zone, NR_SHMEM); + - zone_page_state(zone, NR_SHMEM) + - zone_page_state(zone, NR_SWAPCACHE); } else if (zone_idx < classzone_idx) { if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0)) { if (!use_cma_pages) { diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index da467b6a65d..8455a36afcb 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -158,6 +158,7 @@ enum zone_stat_item { NR_CMA_ACTIVE_FILE, NR_CMA_UNEVICTABLE, #endif + NR_SWAPCACHE, NR_VM_ZONE_STAT_ITEMS }; /* diff --git a/mm/swap_state.c b/mm/swap_state.c index 41bd0e8462a..c4f853908f5 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -97,6 +97,7 @@ int __add_to_swap_cache(struct page *page, swp_entry_t entry) if (likely(!error)) { address_space->nrpages++; __inc_zone_page_state(page, NR_FILE_PAGES); + __inc_zone_page_state(page, NR_SWAPCACHE); INC_CACHE_INFO(add_total); } spin_unlock_irq(&address_space->tree_lock); @@ -149,6 +150,7 @@ void __delete_from_swap_cache(struct page *page) ClearPageSwapCache(page); address_space->nrpages--; __dec_zone_page_state(page, NR_FILE_PAGES); + __dec_zone_page_state(page, NR_SWAPCACHE); INC_CACHE_INFO(del_total); } diff --git a/mm/vmstat.c b/mm/vmstat.c index 5af49652211..c22c9a9f9d3 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -733,6 +733,7 @@ const char * const vmstat_text[] = { "nr_cma_active_file", "nr_cma_unevictable", #endif + "nr_swapcache", "nr_dirty_threshold", "nr_dirty_background_threshold",