From: Niko Jokinen <ext-niko.k.jokinen@nokia.com>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: SysV swapped shared memory calculated incorrectly
Date: Tue, 04 Aug 2009 18:07:32 +0300 [thread overview]
Message-ID: <1249398452.3905.268.camel@niko-laptop> (raw)
Hi,
Tested on 2.6.28 and 2.6.31-rc4
SysV swapped shared memory is not calculated correctly
in /proc/<pid>/smaps and also by parsing /proc/<pid>/pagemap.
Rss value decreases also when swap is disabled, so this is where I am
lost as how shared memory is supposed to behave.
I have test program which makes 32MB shared memory segment and then I
use 'stress -m 1 --vm-bytes 120M', --vm-bytes is increased until rss
size decreases in smaps. Swap value never increases in smaps.
On the other hand shmctl(0, SHM_INFO, ...) does show shared memory in
swap because shm.c shm_get_stat() uses inodes to get values.
When test program is started:
shmctl() printout:
SHM_INFO (sys-wide): total : 34580 kB
rss : 34388 kB
swap : 192 kB
smaps printout:
40153000-42153000 rw-s 00000000 00:08 1703949 /SYSV54016264 (deleted)
Size: 32768 kB
Rss: 32768 kB
Pss: 32768 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 32768 kB
Referenced: 32768 kB
Swap: 0 kB
------------
After all memory is allocated (without swap smaps is the same, except
SHM_INFO shows 'Swap: 0' like it should), first byte is read hence the
4KB Referenced:
SHM_INFO (sys-wide): total : 34580 kB
rss : 1528 kB
swap : 33052 kB
40153000-42153000 rw-s 00000000 00:08 1867789 /SYSV54016264 (deleted)
Size: 32768 kB
Rss: 4 kB
Pss: 4 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 4 kB
Private_Dirty: 0 kB
Referenced: 4 kB
Swap: 0 kB
------------
task_mmu.c, smaps_pte_range():
if (is_swap_pte(ptent)) {
mss->swap += PAGE_SIZE;
continue;
}
if (!pte_present(ptent))
continue;
When all memory is allocated pte_present() returns false for shared
memory. is_swap_pte() is never true for shared memory.
Ideas how to fix?
Br,
Niko Jokinen
--
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:[~2009-08-04 14:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-04 15:07 Niko Jokinen [this message]
2009-08-05 18:21 ` Hugh Dickins
2009-08-07 8:08 ` Niko Jokinen
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=1249398452.3905.268.camel@niko-laptop \
--to=ext-niko.k.jokinen@nokia.com \
--cc=linux-mm@kvack.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