Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Compiling inside a tmpfs seems to trigger kernel oom killer.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Sun Jun 20, 2010 6:47 pm    Post subject: Compiling inside a tmpfs seems to trigger kernel oom killer. Reply with quote

I was not sure where to post this, since there are a few forums into which it can go.

Anyway, I am running Gentoo Linux ~amd64 on a system with 4GB of RAM, an 8GB swap partition, and a 8GB tmpfs mounted at /var/tmp/portage. I am using sys-kernel/vanilla-sources-2.6.34. I have noticed that if I compile too many things in parallel, even if the tmpfs is barely utilized, the oom killer seems to activate. This is true with open office where it tends to die with an error message. It also happened last night when I was running emerge --jobs --keep-going -avDuN kde-base/kdeartwork-meta kde-base/kdeadmin-meta kde-base/kdeaccessibility-meta kde-base/kdesdk-meta kde-base/kdewebdev-meta kde-base/kdeutils-meta. Some times this issue manifests itself in terms of segmentation faults when compiling.

Does anyone have any idea why this is happening?

Edit: I just ran dd bs=4096 count=2097152 if=/dev/zero of=/var/tmp/portage/zero.bak. The system became extremely unresponsive when I did this and stayed that way until it finished writing. ksysguard was running at the time and seemed to have crashed, but the operation completed without issue, so I am at a loss to explain why unmounting the tmpfs directory tends to fix things.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Mon Jun 21, 2010 12:22 am    Post subject: Reply with quote

I'm not sure if tmpfs is able to use swap as a backing store. If it isn't, then 4GB is definitely not enough to hold an openoffice compilation (8GB should be sufficient but I'm not sure), and expect in the neighborhood of additional 800MB RAM consumed at peak (with 1 job on 64 bit). Compiling openoffice 64 bit on 512MB RAM is downright painful for a particular file but it does complete eventually. The fact that your dd test completed (at least if it really stored that much data) seems to suggest swap can be used for tmpfs though...

Running out of memory shouldn't cause things to segfault (rather the OOM killer should kill something to free some memory or kill the process itself), but bad programming to handle resulting errors might.

If this is happening without a significant majority of your RAM being consumed, then it sounds like a kernel bug, but running out of RAM doesn't always have a graceful outcome. I'm not sure how much storage that KDE compilation you did would end up using.

A potentially confounding factor is that I don't think tmpfs allocation is reflected in the +/- buffers/cache line in `free` output, so I'd suggest using df to check the tmpfs size.


Last edited by BradN on Mon Jun 21, 2010 12:29 am; edited 1 time in total
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Mon Jun 21, 2010 12:27 am    Post subject: Reply with quote

BradN wrote:
I'm not sure if tmpfs is able to use swap as a backing store. If it isn't, then 4GB is definitely not enough to hold an openoffice compilation (8GB should be sufficient but I'm not sure), and expect in the neighborhood of additional 800MB RAM consumed at peak (with 1 job on 64 bit). Compiling openoffice 64 bit on 512MB RAM is downright painful for a particular file but it does complete eventually.

Running out of memory shouldn't cause things to segfault (rather the OOM killer should kill something to free some memory or kill the process itself), but bad programming to handle resulting errors might.

If this is happening without a significant majority of your RAM being consumed, then it sounds like a kernel bug, but running out of RAM doesn't always have a graceful outcome. I'm not sure how much storage that KDE compilation you did would end up using.


My dd bs=4096 count=2097152 if=/dev/zero of=/var/tmp/portage/zero.bak experiment confirmed that the system can swap the contents of a tmpfs to disk. The KDE compilation did not use more than a few hundred megabytes as far as I know. Open Office requires 4 to 6 GB. I have posted this to the kernel mailing list, which unfortunately required that I reveal my real name, so I will avoid posting a link to it here. I am hoping that upstream will be able to help me with this.
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Mon Jun 21, 2010 12:31 am    Post subject: Reply with quote

Just did an edit to my above message while you were posting, but yes in that case it does seem like a bug somewhere.
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Mon Jun 21, 2010 1:35 am    Post subject: Reply with quote

From /usr/src/linux/Documentation/filesystems/tmpfs.txt;
Quote:
The limit of allocated bytes for this tmpfs instance. The
default is half of your physical RAM without swap. If you
oversize your tmpfs instances the machine will deadlock
since the OOM handler will not be able to free that memory.

_________________
"You have to invite me in"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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