Re: [LEDE-DEV] [PATCH] [base-files] dont change defaults for vm.min_free_kbytes on devices with <64mb RAM

2016-09-16 Thread Martin Tippmann
On Fri, Sep 16, 2016 at 3:04 PM, Felix Fietkau  wrote:
> On 2016-09-16 11:31, Bastian Bittorf wrote:
>> with 5c9cc7b7f8920944a413644e1c2ea23bfe655bcb we changed the default
>> value from ~650 to 4096 kilobyte on 32mb-RAM-devices. This makes them
>> hardly useable with a lot of oom-crashes. Fix that and keep the default.
>> For devices with more than 32mb we keep the behaviour and tweak the value.
> How about setting it to 1024 for 32M? That will give drivers a bit more
> room without affecting memory usage that much.

A quick test: opkg works (update, list, install) , luci works mostly
with 1024 (installing packages via luci fails sometimes due to oom,
but that also happens with the lower default value..., everything else
looks good)

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] [base-files] dont change defaults for vm.min_free_kbytes on devices with <64mb RAM

2016-09-16 Thread Bastian Bittorf
with 5c9cc7b7f8920944a413644e1c2ea23bfe655bcb we changed the default
value from ~650 to 4096 kilobyte on 32mb-RAM-devices. This makes them
hardly useable with a lot of oom-crashes. Fix that and keep the default.
For devices with more than 32mb we keep the behaviour and tweak the value.
We dont suppress output of sysctl-command, so the use has a chance to spot it.

While we are at it, localize vars and read the memory without AWK/nonforking.

Signed-off-by: Bastian Bittorf 
---
 package/base-files/files/etc/init.d/sysctl | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/package/base-files/files/etc/init.d/sysctl 
b/package/base-files/files/etc/init.d/sysctl
index a0daec0..c3b48f4 100755
--- a/package/base-files/files/etc/init.d/sysctl
+++ b/package/base-files/files/etc/init.d/sysctl
@@ -4,17 +4,19 @@
 START=11
 
 set_vm_min_free() {
-   mem="$(grep MemTotal /proc/meminfo  | awk '{print $2}')"
-   if [ "$mem" -gt 65536 ]; then # 128M
+   local mem value
+
+   read -r _ mem _ http://lists.infradead.org/mailman/listinfo/lede-dev