LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 05: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, 12:15 PM   #2
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 15
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, 12: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, 05:20 PM   #4
mulyadi.santosa
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: 15
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



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 03:49 PM
LXer: This week at LWN: KSM runs into patent trouble LXer Syndicated Linux News 0 12-15-2008 12:50 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
How much memory will be saved if the x/gui is not started? chickenjoy Linux - Newbie 3 06-17-2007 11:02 PM
Can my monitor be saved? jeffz General 1 08-09-2004 12:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:09 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
Open Source Consulting | Domain Registration