LinuxQuestions.org
Review your favorite Linux distribution.
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 08-25-2010, 09:36 PM   #1
kresyzig
LQ Newbie
 
Registered: Aug 2010
Posts: 10

Rep: Reputation: 0
Question SHM Memory Counted as Cache Memory with Kernel 2.6.18?


Is that possible that SHM shared memory is counted as cache memory on Linux with kernel 2.6.18?

If find it really odd since this memory is not file backed, but I have a piece of code that loads data using shm_open+mmap, and it generates an amount of cache memory in /proc/meminfo that corresponds exactly to the amount of shared memory (I load that data from a file but I am using posix_fadvise(fd,0,0,POSIX_FADV_DONTNEED) to ensure this file is not cached and I made sure that it is working as expected). As far as I know SHM memory was not tagged as cache memory with kernel 2.6.9.

If it is the case it is really unfortunate since normally cache memory can be considered to be part of the "available" memory since it can be flushed promptly but this is clearly not the case with SHM memory... Is there an easy way to get the total amount of used SHM memory on a system?

Last edited by kresyzig; 08-25-2010 at 09:46 PM.
 
Old 08-25-2010, 10:06 PM   #2
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 54
Try upgrading your kernel, maybe that will help. The 2.6.18 kernel is a full 18 point upgrades before the current one, at 2.6.36-rc2.
 
Old 08-25-2010, 10:35 PM   #3
kresyzig
LQ Newbie
 
Registered: Aug 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Kenny_Strawn View Post
Try upgrading your kernel, maybe that will help. The 2.6.18 kernel is a full 18 point upgrades before the current one, at 2.6.36-rc2.
I wish it was an option but I am developing code to be run on standardized clusters running 2.6.18 ...
 
Old 08-25-2010, 10:54 PM   #4
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,485

Rep: Reputation: 66
As far as I know SHM memory is just a ram disk that the kernel uses for programs to communicate with each other. Thus it uses the same memory that the kernel uses for its caches. Other then that I do not think its any different then tempfs just uses a different name.
 
Old 08-25-2010, 11:06 PM   #5
kresyzig
LQ Newbie
 
Registered: Aug 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by exvor View Post
As far as I know SHM memory is just a ram disk that the kernel uses for programs to communicate with each other. Thus it uses the same memory that the kernel uses for its caches. Other then that I do not think its any different then tempfs just uses a different name.
But isn't cache memory by definition some memory used to reduce the access time to an original copy of some data? SHM memory just allows to share RAM between multiple processes, is neither file-backed nor involves multiple copies of the memory, so it is effectively not caching anything, right?

Quote:
A POSIX shared memory object is in effect a handle which can be used by unrelated processes to mmap(2) the same region of shared memory.

Last edited by kresyzig; 08-26-2010 at 06:43 AM.
 
  


Reply

Tags
cache, kernel, linux, memory, mmap, shm


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
Does /dev/shm reduce memory available for non-shared memory segments? mightyscotchpine Linux - Server 1 09-22-2009 06:58 PM
kernel: how do pci-memory a conventional memory? vv40in Linux - Newbie 0 06-05-2008 02:55 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
Help Configuring the Memory Used by a Process in RedHat? (Cache Memory on CPU) geogecko Linux - General 3 02-23-2005 03:32 PM
/dev/shm shared memory allocation tvaneijk Linux - Newbie 0 07-08-2004 07:27 AM


All times are GMT -5. The time now is 08:04 PM.

Main Menu
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