linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan()
@ 2016-02-16  9:37 Xishi Qiu
  2016-02-16 17:38 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Xishi Qiu @ 2016-02-16  9:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, arve, riandrews, devel, zhong jiang; +Cc: LKML, Linux MM

Currently tasksize in lowmem_scan() only calculate rss, and not include swap.
But usually smart phones enable zram, so swap space actually use ram.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
---
 drivers/staging/android/lowmemorykiller.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 8b5a4a8..718ab8e 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -139,7 +139,10 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
 			task_unlock(p);
 			continue;
 		}
-		tasksize = get_mm_rss(p->mm);
+		tasksize = get_mm_rss(p->mm) +
+			   get_mm_counter(p->mm, MM_SWAPENTS) +
+			   atomic_long_read(&p->mm->nr_ptes) +
+			   mm_nr_pmds(p->mm);
 		task_unlock(p);
 		if (tasksize <= 0)
 			continue;
-- 
1.8.3.1


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-02-23  0:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16  9:37 [PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan() Xishi Qiu
2016-02-16 17:38 ` Greg Kroah-Hartman
2016-02-17  0:35   ` David Rientjes
2016-02-17  8:30     ` Xishi Qiu
2016-02-17 22:42       ` David Rientjes
2016-02-17 18:10     ` Michal Hocko
2016-02-18  6:51     ` Xishi Qiu
2016-02-23  0:54       ` David Rientjes
2016-02-18  7:55     ` Figo.zhang
2016-02-18 10:21       ` Xishi Qiu
2016-02-23  0:50         ` David Rientjes

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