LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-24-2021, 03:42 PM   #16
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51

Quote:
Originally Posted by syg00 View Post
How tmpfs is sized is covered in the link I gave. When/wether it will be moved to swap is impossible to predict in advance.
Memory management is much more complicated than you can imagine. A good start for a simple explanation is linuxatemyram
I have read this page, now. Very good information, thank you. I also read the play page linked in the end of it.

Now, i can say clearly to all of you: i was not counfounding cached memory with used memory, in my original question. So, i still have the doubt: if RAM memory is completely used by programs, will /dev/shm space still exist and work? I guess it must be counted as what is used by programs, in the total of RAM + swap size - right?
 
Old 02-24-2021, 06:01 PM   #17
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
A request by /dev/shm for memory will be handled just like a memory allocation request by any other program. If sufficient free RAM is not currently available, the request will be satisfied by one of the following (roughly in order):
  1. Discarding cached pages,
  2. Flushing buffers,
  3. Moving pages out to swap space,
  4. Discarding pure text pages (which can always be reloaded from disk).
And of course there is the last resort of the OOM killer terminating processes.

The point is that there is nothing special about a tmpfs wanting memory vs. any other memory request by a program. A tmpfs has a size limit (which defaults to 50% of the system's physical RAM), just as programs have a maximum size (set by ulimit),

Last edited by rknichols; 02-24-2021 at 06:03 PM.
 
1 members found this post helpful.
Old 02-24-2021, 06:45 PM   #18
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
https://datacadamia.com/os/linux/shared_memory

However, it seems odd to have your memory climbing day by day.
 
Old 02-24-2021, 08:51 PM   #19
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by rknichols View Post
A request by /dev/shm for memory will be handled just like a memory allocation request by any other program. If sufficient free RAM is not currently available, the request will be satisfied by one of the following (roughly in order):
  1. Discarding cached pages,
  2. Flushing buffers,
  3. Moving pages out to swap space,
  4. Discarding pure text pages (which can always be reloaded from disk).
And of course there is the last resort of the OOM killer terminating processes.

The point is that there is nothing special about a tmpfs wanting memory vs. any other memory request by a program. A tmpfs has a size limit (which defaults to 50% of the system's physical RAM), just as programs have a maximum size (set by ulimit),
Thank you very much for your detailed explation.
 
Old 02-24-2021, 09:07 PM   #20
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by jefro View Post
https://datacadamia.com/os/linux/shared_memory

However, it seems odd to have your memory climbing day by day.
Yes, it seems very strange. I do not like it, but my computer reboots in a fair frequency by blackouts, which are not really uncommon where i live. So, extending my test to memory occupied until, for example, 100% RAM + 50% swap are full, after more days of use, is not possible. So, pointing the fault is harder - unless i buy a no break. Testing the memory with linuxatemyram.com little programs is possible, but it will not solve my problem to find the memory hole, if this is the case (remember, i will still check the amount of memory after a clean boot, and after opening everything in this moment).

Anyway, my main doubt with this thread was how /dev/shm requests would be handled when RAM is full, and rknichols clarified it very well, now. For other things, the thread is still open, but i will mark it solved.
 
Old 03-10-2021, 04:32 PM   #21
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Experimenting with how much my used memory would grow, i stopped restarting Vivaldi, which behaves better than Firefox and Thunderbird, for its predictability in memory usage. Right now, according to Mate's system monitor graphics (shown in screenshots above), 90% of RAM is used by programs, and 50% as cache. Curiously, to me, 90%+50% = 140%... strange? Further, today, my computer started to using some swap. 9% of swap is being used, at this moment. I wonder if swap will get direct cuts when i close Vivaldi, and maybe Firefox too, to check how much memory will be recovered.

But i imagine that swap can be left there as is, if it is made of things not much accessed. Or not? Will it be moved to free RAM without its data being accessed?
 
Old 03-10-2021, 04:41 PM   #22
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by dedec0 View Post
Further, today, my computer started to using some swap. 9% of swap is being used, at this moment. I wonder if swap will get direct cuts when i close Vivaldi, and maybe Firefox too, to check how much memory will be recovered.
The pages currently in swap will probably stay there. Those will be mostly pages that were needed when various long-running programs and daemons started up, and were never referenced again.
Quote:
But i imagine that swap can be left there as is, if it is made of things not much accessed. Or not? Will it be moved to free RAM without its data being accessed?
No. Why would you want unreferenced pages occupying physical RAM?
 
1 members found this post helpful.
Old 03-10-2021, 07:35 PM   #23
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by rknichols View Post
No. Why would you want unreferenced pages occupying physical RAM?
Exactly! So, leave RAM for things that probably will be more used, and will not demand disk usage, which has much lower life.
 
  


Reply

Tags
/dev/shm, ram, swap



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
differences betwne /dev/shm and kernel.shm hallask Linux - Server 2 09-23-2011 06:26 AM
/dev/shm not mounted /dev busy compgenius999 Linux - Newbie 1 03-03-2010 11:12 AM
Sizes of /dev /dev/shm /lib/init/rw jmoschetti45 Linux - Server 0 01-25-2010 11:20 AM
What is /dev/pts, /dev/shm? mrpc_cambodia Red Hat 1 10-18-2004 03:27 AM
RAM DISK /dev/shm RH 7.2 . Why? peter_robb Linux - Software 0 02-06-2002 08:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:42 PM.

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