From: Xishi Qiu <qiuxishi@huawei.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
arve@android.com, riandrews@android.com,
devel@driverdev.osuosl.org, zhong jiang <zhongjiang@huawei.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Linux MM <linux-mm@kvack.org>
Subject: [PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan()
Date: Tue, 16 Feb 2016 17:37:05 +0800 [thread overview]
Message-ID: <56C2EDC1.2090509@huawei.com> (raw)
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>
next reply other threads:[~2016-02-16 9:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 9:37 Xishi Qiu [this message]
2016-02-16 17:38 ` [PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan() 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
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=56C2EDC1.2090509@huawei.com \
--to=qiuxishi@huawei.com \
--cc=arve@android.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riandrews@android.com \
--cc=zhongjiang@huawei.com \
/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).