lkml.org 
[lkml]   [2009]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Long lasting MM bug when swap is smaller than RAM
Attila Kinali wrote:
> On Wed, 1 Jul 2009 10:04:32 +0200
> Attila Kinali <attila@kinali.ch> wrote:
>
>>> But
>>> swapping does not only occur if memory is running low. If disk usage is
>>> high then non-recently used data may be swapped out to make more room
>>> for disk caching.
>> Hmm..I didn't know this.. thanks!
>
> This was the cause of the problem!
>
> I just restarted svnserv, clamav and bind (the three applications
> using most memory) and suddenly swap cleared up.
>
> Now the question is, why did they accumulate so much used swap
> space, while before the RAM upgrade, we hardly used the swap space at all?

I do not know about the others, but ClamAV suffers from pretty serious
memory fragmentation. What it does is load the updated signatures into
a new memory allocation, verify them, then free the old signature
allocation. This results in a large hole in glibc's malloc structures
and because of ClamAV's allocation pattern, this hole is difficult to
reclaim. This ClamAV memory fragmentation will continue to grow worse
until the daemon is completely restarted.

Under memory pressure the kernel pushes least used pages out to swap,
and these unused but still allocated pages of ClamAV are never again
used, so out to swap they go.

I know this because the company I work for tried to fix the memory
allocation fragmentation of ClamAV, but they did not like our patch and
preferred to continue allowing the memory allocator to fragment in
exchange for simpler code.

--
Zan Lynx
zlynx@acm.org

"Knowledge is Power. Power Corrupts. Study Hard. Be Evil."


\
 
 \ /
  Last update: 2009-07-02 01:19    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site