Bug 40402 - Memory being cached and not released causing out_of_memory issue or high swap usage when memory is not used up
Summary: Memory being cached and not released causing out_of_memory issue or high swap...
Status: NEW
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 blocking
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-01 10:04 UTC by ultimatebusta
Modified: 2019-11-15 19:49 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.38 2.6.39
Tree: Mainline
Regression: No


Attachments

Description ultimatebusta 2011-08-01 10:04:07 UTC
Hi,

This is my first bug report to kernel.org, so I apologize if I failed to do something.

I've been having issues with memory for the past month or so (Physical memory installed is 4GB). It started out with random freezes, usually occurring a couple hours after initial boot. Then the system will freeze completely. Later, through logs, I found this:

http://pastebin.com/raw.php?i=KAc87YVa

This shows me that I'm out of memory, but I'm far from that, as I hardly ever use more than 1.5GB of memory. 

Later I realized that this was caused by swap being full, and no memory could be allocated, as demonstrated by this screencap:

http://i.stack.imgur.com/Wuvf1.png

Finally I noticed a trend from free -m:

1. Boot up computer, the "cached" part is low and the "free" part is high
2. Gradually, the "cached" part increases and the "free" part decreases.
3. The "free" part drops to around 100MB
4. Swap begins accumulating.

I've done some homework, although I do not completely understand what "cached" actually does, I know that it's suppose to be automatically released by the kernel if a program requested more memory in "free" (at least this is how I understand it).

Demonstrated by this free -m output:

             total       used       free     shared    buffers     cached
Mem:          3760       3653        107          0          4       2638
-/+ buffers/cache:       1010       2750
Swap:         3890       2643       1247

Currently I have to restart every 8 hours in order to avoid a total system freeze after swap goes full. (can't move mouse, lasts forever (40 minutes and got impatient.. hard reset))

My current system is Ubuntu 11.04 64bit with the kernel compiled with kernelcheck. uname -r: 2.6.39.3-candela

Also, I'm apparently not the only person experiencing this issue, someone from the #ubuntu-cn chatroom is also having this issue with Ubuntu 11.04 32bit with a generic kernel (uname -r: 2.6.38-11-generic) (2GB RAM) (5 hours per restart)

There's also maybe another person experiencing the same issue on Fedora, yet his case has yet to be confirmed. (16GB ram and recently upgraded to the 2.6.40 kernel, yet to confirm with both the old and the new kernel as it takes him 52 hours in order for cached to "eat" all the ram)

If you need any additional information, I'll be happy to provide them to you, and you can also find us on #ubuntu-cn (Find Pwnna)

Thank you very much.
Comment 1 ultimatebusta 2011-08-02 06:55:20 UTC
Also, I've tried the swappiness setting of 60, 10, and 0. None of these seems to work.

I also tried to use echo 1 > /proc/sys/vm/drop_caches (as well as 2 and 3), but they don't work either (working initially, and fails later).

The user with 16GB of RAM is on Fedora 15 64bit (kernel: 2.6.38-35) and reported that swappiness setting of 3 eased the issue, although we didn't confirm that as he restarted due to the upgrade to linux kernel 3 (2.6.40).
Comment 2 ultimatebusta 2011-08-12 19:26:32 UTC
Upgraded to 2.6.39.4, didn't help either:

http://pastebin.com/raw.php?i=fHAyd1x7
Comment 3 xerofoify 2014-06-25 16:05:46 UTC
Please test against a newer kernel to see if it's fixed.
Cheers Nick

Note You need to log in before you can comment on or make changes to this bug.