Set memory limits according to LOWMEM, not TOTALMEM
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 18 Dec 2008 16:50:43 +0000 (16:50 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 18 Dec 2008 16:50:43 +0000 (16:50 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@622 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_main.c

index 173fac1..69ecede 100644 (file)
@@ -1822,10 +1822,11 @@ static int __init init_scst(void)
                si_meminfo(&si);
 #if BITS_PER_LONG == 32
                scst_max_cmd_mem = min(
-                       (((uint64_t)si.totalram << PAGE_SHIFT) >> 20) >> 2,
-                       (uint64_t)1 << 30);
+                       (((uint64_t)(si.totalram - si.totalhigh) << PAGE_SHIFT)
+                               >> 20) >> 2, (uint64_t)1 << 30);
 #else
-               scst_max_cmd_mem = ((si.totalram << PAGE_SHIFT) >> 20) >> 2;
+               scst_max_cmd_mem = (((si.totalram - si.totalhigh) << PAGE_SHIFT)
+                                       >> 20) >> 2;
 #endif
        }