Jose Mª Ferreiro wrote:
> Andrei Martynov escribió:
> >I'm using kernel 2.6.24 with uClinux and ARM NOMMU patches. When one
> >application starts reading from disk kernel uses all available memory
> >for caching and other applications fail to start (not enough memory).
> >It takes kernel up to 10 seconds to release memory after the first
> >application exits.
> >
> >Is there any way to limit disk cache size?
> >...
> 
> Hello
> 
> I came to his thread because we had a similar issue: applications didn´t 
> start or start badly because system fails out of memory. I have not 
> found any reference to how to set that limit. It seems as if it works 
> that way: no limit; the mm system decides when and how  :-(

The problem is fragmentation, not running out of memory, and it's
quite difficult to solve.

Limiting the cache sizes could help but it's not enough by itself -
you also need to cluster cache memories, and limit the size more
rigidly than mm's default async method.  Otherwise even a small amount
of cache gets spread randomly through memory and blocks large
allocations.

The kernel does have a strategy for this - look at migrationtype and
pageblock in mm/*.c, but it seems to be not effective enough for small
RAM sizes and NOMMU allocation patterns.

The 10 second time is due to the mm/ strategy not working very well.

> We are working with this workaround:
> echo 3 > /proc/sys/vm/drop_caches
> 
> This clears all the cache. We even write this value to that file within 
> our application start routine to be sure our main application gets all 
> the memory it needs. It seems to be working

It's good to know that works, thanks.

Another trick is to divide your application into several shared
libraries which are significantly smaller than the original, if your
toolchain supports it.

-- Jamie
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to