From: Yogesh Narayan Gaur <yn.gaur@samsung.com>
To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
"ajeet.y@samsung.com" <ajeet.y@samsung.com>,
amit.arora@samsung.com
Subject: [EDT] oom_killer: find bulkiest task based on pss value
Date: Fri, 08 May 2015 05:29:28 +0000 (GMT) [thread overview]
Message-ID: <1803318889.244481431062967826.JavaMail.weblogic@epmlwas09d> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 2840 bytes --]
EP-2DAD0AFA905A4ACB804C4F82A001242F
Hi Andrew,
Presently in oom_kill.c we calculate badness score of the victim task as per the present RSS counter value of the task.
RSS counter value for any task is usually '[Private (Dirty/Clean)] + [Shared (Dirty/Clean)]' of the task.
We have encountered a situation where values for Private fields are less but value for Shared fields are more and hence make total RSS counter value large. Later on oom situation killing task with highest RSS value but as Private field values are not large hence memory gain after killing this process is not as per the expectation.
For e.g. take below use-case scenario, in which 3 process are running in system.
All these process done mmap for file exist in present directory and then copying data from this file to local allocated pointers in while(1) loop with some sleep. Out of 3 process, 2 process has mmaped file with MAP_SHARED setting and one has mapped file with MAP_PRIVATE setting.
I have all 3 processes in background and checks RSS/PSS value from user space utility (utility over cat /proc/pid/smaps)
Before OOM, below is the consumed memory status for these 3 process (all processes run with oom_score_adj = 0)
====================================================
Comm : 1prg, Pid : 213 (values in kB)
Rss Shared Private Pss
Process : 375764 194596 181168 278460
====================================================
Comm : 3prg, Pid : 217 (values in kB)
Rss Shared Private Pss
Process : 305760 32 305728 305738
====================================================
Comm : 2prg, Pid : 218 (values in kB)
Rss Shared Private Pss
Process : 389980 194596 195384 292676
====================================================
Thus as per present code design, first it would select process [2prg : 218] as bulkiest process as its RSS value is highest to kill. But if we kill this process then only ~195MB would be free as compare to expected ~389MB.
Thus identifying the task based on RSS value is not accurate design and killing that identified process didnt release expected memory back to system.
We need to calculate victim task based on PSS instead of RSS as PSS value calculates as
PSS value = [Private (Dirty/Clean)] + [Shared (Dirty/Clean) / no. of shared task]
For above use-case scenario also, it can be checked that process [3prg : 217] is having largest PSS value and by killing this process we can gain maximum memory (~305MB) as compare to killing process identified based on RSS value.
--
Regards,
Yogesh Gaur.ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2015-05-08 5:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 5:29 Yogesh Narayan Gaur [this message]
2015-05-08 7:47 ` yalin wang
2015-05-11 3:25 ` 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=1803318889.244481431062967826.JavaMail.weblogic@epmlwas09d \
--to=yn.gaur@samsung.com \
--cc=ajeet.y@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=amit.arora@samsung.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®