LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-16-2012, 06:11 AM   #1
demon007
LQ Newbie
 
Registered: Sep 2011
Posts: 13

Rep: Reputation: Disabled
Monitor memory saved from KSM


I am marking the allocated memory for my program as mergeable. While checking the pages shared in KSM I can see that pages are getting merged in that program.

To check how much memory is saved by page merging, I run the program with mergeable and without mergeable.

But when I check with top command it shows that same amount of memory is used.

I am not able to figure that if the pages are getting merged then how it is showing same amount of memory used.

Please help me.

Thanks in advance.
 
Old 03-08-2012, 01:15 PM   #2
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 14
Hi

I am just guessing that top "thinks" the KSM merged pages are like shared library.

from process address space's point of view, those pages are still mapped on each processes, thus are counted in their RSS (resident set size). The same like your shared libraries. It might be single .so file, but mapped into say 3 programs. Well then, each of them will count this .so into their RSS, while in fact only lesser amount of file backed pages are used.

Hope I explained it clearly
 
Old 03-08-2012, 01:40 PM   #3
demon007
LQ Newbie
 
Registered: Sep 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
I think its correct but that is my problem. I mean I want to monitor those savings. So if top cannot show it, then how to monitor how much memory is being saved.

Quote:
Originally Posted by mulyadi.santosa View Post
Hi

I am just guessing that top "thinks" the KSM merged pages are like shared library.

from process address space's point of view, those pages are still mapped on each processes, thus are counted in their RSS (resident set size). The same like your shared libraries. It might be single .so file, but mapped into say 3 programs. Well then, each of them will count this .so into their RSS, while in fact only lesser amount of file backed pages are used.

Hope I explained it clearly
 
Old 03-08-2012, 06:20 PM   #4
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 14
Hi

I think you need to rely on /proc/meminfo directly. IIRC, "anonpages" is what you need:

Code:
grep -i anonpage /proc/meminfo
See if that helps you
 
  


Reply

Tags
memory, memory management, merge


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
memory metric to monitor memory usage or swap? karlochacon Linux - Newbie 5 08-13-2011 04:49 PM
LXer: This week at LWN: KSM runs into patent trouble LXer Syndicated Linux News 0 12-15-2008 01:50 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 05:05 AM
How much memory will be saved if the x/gui is not started? chickenjoy Linux - Newbie 3 06-18-2007 12:02 AM
Can my monitor be saved? jeffz General 1 08-09-2004 01:08 AM


All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration