View previous topic :: View next topic |
Author |
Message |
mathfeel l33t
Joined: 03 Aug 2004 Posts: 700
|
Posted: Fri Dec 02, 2011 1:37 am Post subject: swapping when there is no swap? |
|
|
Sometimes, especially when I have browser with ~20 tabs open and running a large emerge in the background (e.g. icedtea, chromium), the system starts to hit the hard drive hard. Cursor can still move, but the system is otherwise non-responsive. I though this maybe due to the system swapping. But in a recent boot, I commented out the line in /etc/fstab that points to the swap. Why is the system still hitting the hard drive?
Basically, I would like certain running user process (in particular, emerge or ebuild) to crash when physical memory limit is reached. Is this possible? _________________ -----------------------------------------------------------
"In heaven all the interesting people are missing"
-- Friedrich Nietzsche |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23093
|
Posted: Fri Dec 02, 2011 3:10 am Post subject: |
|
|
If you have insufficient memory to keep everything resident at once, and there is no swap, then the only remaining option is to begin discarding pages that can be reread from the hard disk. The executable and readonly data portions of programs and libraries can be reread from the disk at need, so they are never written to swap. It is likely that the kernel started discarding such pages, then was reading them back soon after because you had accessed them again.
You may be able to constrain some processes by using resource limits and/or cgroups. However, this would only control their growth. It would not ensure that the OOM killer was invoked prematurely and directed to kill those specific processes. |
|
Back to top |
|
|
wcg Guru
Joined: 06 Jan 2009 Posts: 588
|
Posted: Fri Dec 02, 2011 7:58 am Post subject: |
|
|
Try leaving swap enabled and setting
Code: |
PORTAGE_NICENESS="15"
|
in /etc/make.conf. (I do not know if it is necessary to quote this value.
I was simply being consistent with other variables defined in /etc/make.conf.)
Someone mentioned this in another thread recently, and it works
pretty well for emerges concurrent with interactive use. The running emerge
will normally be lower priority than anything else running, and the kernel
will set an ionice value for it calculated from its priority. Even if it is doing a
lot of disk i/o and using a lot of cpu when gcc or g++ are running,
anything else that wants to run (like X event handling) gets scheduled
ahead of it. _________________ TIA |
|
Back to top |
|
|
cach0rr0 Bodhisattva
Joined: 13 Nov 2008 Posts: 4123 Location: Houston, Republic of Texas
|
Posted: Fri Dec 02, 2011 10:30 am Post subject: Re: swapping when there is no swap? |
|
|
mathfeel wrote: | Sometimes, especially when I have browser with ~20 tabs open and running a large emerge in the background (e.g. icedtea, chromium), the system starts to hit the hard drive hard. Cursor can still move, but the system is otherwise non-responsive. I though this maybe due to the system swapping. But in a recent boot, I commented out the line in /etc/fstab that points to the swap. Why is the system still hitting the hard drive?
Basically, I would like certain running user process (in particular, emerge or ebuild) to crash when physical memory limit is reached. Is this possible? |
on the browser side at least, most of them will have some kind of local storage (e.g. sqlite) for various bits and pieces
i would wager this is a non-trivial chunk of it. _________________ Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash |
|
Back to top |
|
|
mathfeel l33t
Joined: 03 Aug 2004 Posts: 700
|
Posted: Sat Dec 03, 2011 5:33 am Post subject: |
|
|
The problem is when this happens, I can't really run top or ps because the system is unresponsive. The best I can do is SysRq+RE out. So it is not completely clear to me if it is a memory issue. I assumed that it is because it happens only when multitab-browser + heavy emerge occurs.
Information I left out is that I have 6GB of RAM, and /var/tmp/ is a 3GB maximum tmpfs (the other tmpfs mount is /dev/shm, but that's usually near empty). I was under the impression that tmpfs do not actually use physical memory until it is needed. Either way, seems to me even with 3GB of physical memory available should be plentiful.
I will try to adjust PORTAGE_NICENESS. My current setting is 10. As for cgroups, I need research more information on that. _________________ -----------------------------------------------------------
"In heaven all the interesting people are missing"
-- Friedrich Nietzsche
Last edited by mathfeel on Sat Dec 03, 2011 6:46 am; edited 1 time in total |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Sat Dec 03, 2011 6:46 am Post subject: Re: swapping when there is no swap? |
|
|
mathfeel wrote: | Sometimes, especially when I have browser with ~20 tabs open and running a large emerge in the background (e.g. icedtea, chromium), the system starts to hit the hard drive hard. |
Probably 2 things you need:
1. sqlite trick to avoid calling sync.
2. ionice, as well as nice, your emerge, to stop it from hogging the drive. Example I use (different distro): In /root/.bashrc
Code: | alias lin="ionice -c3 schedtool -D -e /sbin/lin" |
Just change "lin" to "emerge", and that should be OK. I'm using BFS. Also see other tweaks. |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9891 Location: almost Mile High in the USA
|
Posted: Mon Dec 05, 2011 12:40 am Post subject: |
|
|
I don't think anyone should rely on OOMkiller to kill any process that uses more RAM than available. Fortunately for the most part, an emerge, when out of RAM, will tend to be the program that will get killed when out of RAM. However there is a remote chance that a sleeping process gets awakened and gets zapped as it tries to allocate more RAM. Not that it happens often but this can happen and this is not behavior that's predictable.
You should have swap...and prepare for the times when you think you'll be out of RAM. And keep less stuff in RAM!
Swap unfortunately tends to be highest priority. This is because the computer cannot have forward progress executing code while something is in swap - it has to fetch from disk else it's starved of code to run. The only time it may be OK to have code stuck indefinitely in swap is if it's marked as a "idle" process in terms of real-time scheduling priority. _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|