I have a WRT160NL linksys router with 32MB RAM and with OpwnWRT installed. I have an application running which does some heavy writing to log files to a usb connected flash drive. (basically 26MB a day, which is almost as much as the router's memory).
What I have witnessed is that the router reboots itself every 24h or so. After monitoring various system parameters in the router, I noticed that the Buffers parameter in /proc/meminfo had a steady decline from 3kB to roughly 700B throughout the day, until it rebooted. Also, the SUnreclaim parameter has a steady increase from 8k to 13k during these 24h. Both these parameters return to 3k and 8k respectively after the reboot.
So I've noticed that the router reboots both when the Buffers parameter reaches that 700B threshold and SUnreclaim reaches that 13k threshold. At that point the load average starts steadilly increasing until it reaches a point where it has to reboot itself. I assume the decrease of the Buffers parameter is related to the increase of the SUnreclaim parameter.
Ok, so I've already tried to clear the cache to free up memory (sync; echo 3 > /proc/sys/vm/drop_cache), but it doesn't do any good but delay the problem for a very small period of time. I've also tried to tune some of the memory related variables in /proc/sys/vm/ but with little or no result (SUnreclaim keeps increasing no matter what I do - and I'm still trying some alternative tunings).
Thing is, when I run the router without the application, all these parameters are unchanged throughout the days, and the router doesn't reboot at all!
Also, when I turn off some of the logging (which is made trough pipes and redirects in bash script) the decline is less than the usual (it takes 4 days to reboot instead of 1).
So I assume the problem has to do with the Unreclaimable memory. Interpreting the name "Unreclaimable", I assume this memory is kept by the kernel and is never accessible again to the user level, meaning that I have less and less memory available throughout the hours in a system that already has very little memory to begin with...
There seams to be very little information on what the Unreclaimable Slab memory is, and why it happens. If you could explain this, I would be grateful.
Can anyone help me understand what the problem may be? Or how can I stop these declines/increases from happening, causing the router to reboot?
Sorry for the testament. Thanks in advance.