[rhel6-branch 2/2] memory: increase the RAM limits, check for URL installs (#549653).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to higher memory consumption of LVM, kernel, anaconda and other
running processes in general our current memory limits are insufficient
and the increase is neccessary. I am also introducing additional check for
URL installs which require another 108 MB from the ramdisk, no need to
penalize other install methods.

This is the current memory budget:
- unpacked initrd takes 63 MB
- running processes (anaconda, loader, udev, nm): 67 MB (estimate)
- peak LVM memory consumption: up to additional 56 MB
- with URL install install.img takes additional: 108 MB
- memory requriements of X additional: 256 MB (estimate)

Currently we always expect there will be calls to lvm (though we could do
another memory check just at the moment where the necessity arises). All
of the estimates are on the upper bound, still I am running into OOM
easily with text install+http stage2+lvm detection with the old limits.
---
 anaconda     |   37 +++++++++++++++++++++++++++++--------
 isys/isys.c  |    1 +
 isys/isys.h  |    5 +++--
 isys/isys.py |    1 +
 4 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/anaconda b/anaconda
index e85a70a..a5c586f 100755
--- a/anaconda
+++ b/anaconda
@@ -358,24 +358,41 @@ def runVNC():
                     sys.stdin.readline()
                     iutil.execConsole()
 
-def checkMemory(opts):
-    if iutil.memInstalled() < isys.MIN_RAM:
+def check_memory(opts, display_mode=None):
+    def within_available_memory(needed_ram):
+        # kernel binary code estimate that is
+        # not reported in MemTotal by /proc/meminfo:
+        epsilon = 15360 # 15 MB
+        return needed_ram < (iutil.memInstalled() + epsilon)
+
+    if not display_mode:
+        display_mode = opts.display_mode
+
+    extra_ram = 0
+    reason = ''
+    if opts.stage2.startswith(('http', 'ftp', '@')):
+        extra_ram += isys.URL_INSTALL_EXTRA_RAM
+        reason = " using this install method"
+
+    needed_ram = isys.MIN_RAM + extra_ram
+    if not within_available_memory(needed_ram):
         from snack import SnackScreen, ButtonChoiceWindow
-
         screen = SnackScreen()
         ButtonChoiceWindow(screen, _('Fatal Error'),
                             _('You do not have enough RAM to install %s '
-                              'on this machine.\n'
+                              'on this machine%s.\n'
                               '\n'
                               'Press <return> to reboot your system.\n')
-                           %(product.productName,),
+                           %(product.productName, reason),
                            buttons = (_("OK"),))
         screen.finish()
         sys.exit(0)
 
     # override display mode if machine cannot nicely run X
-    if not flags.usevnc:
-        if opts.display_mode not in ('t', 'c') and iutil.memInstalled() < isys.MIN_GUI_RAM:
+    if display_mode not in ('t', 'c') and not flags.usevnc:
+        needed_ram = isys.MIN_GUI_RAM + extra_ram
+
+        if not within_available_memory(needed_ram):
             stdoutLog.warning(_("You do not have enough RAM to use the graphical "
                                 "installer.  Starting text mode."))
             opts.display_mode = 't'
@@ -673,6 +690,9 @@ if __name__ == "__main__":
 
     (opts, args) = parseOptions()
 
+    # check memory, just the text mode for now:
+    check_memory(opts, 't')
+
     if opts.unsupportedMode:
         stdoutLog.error("Running anaconda in %s mode is no longer supported." % opts.unsupportedMode)
         sys.exit(0)
@@ -887,7 +907,8 @@ if __name__ == "__main__":
     log.info("Display mode = %s" %(opts.display_mode,))
     log.info("Default encoding = %s " % sys.getdefaultencoding())
 
-    checkMemory(opts)
+    # check memory again, with the real display mode:
+    check_memory(opts)
 
     # this lets install classes force text mode instlls
     if instClass.forceTextMode:
diff --git a/isys/isys.c b/isys/isys.c
index 6a2d18d..2694641 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -315,6 +315,7 @@ void init_isys(void) {
 
     PyDict_SetItemString(d, "MIN_RAM", PyInt_FromLong(MIN_RAM));
     PyDict_SetItemString(d, "MIN_GUI_RAM", PyInt_FromLong(MIN_GUI_RAM));
+    PyDict_SetItemString(d, "URL_INSTALL_EXTRA_RAM", PyInt_FromLong(URL_INSTALL_EXTRA_RAM));
     PyDict_SetItemString(d, "EARLY_SWAP_RAM", PyInt_FromLong(EARLY_SWAP_RAM));
 }
 
diff --git a/isys/isys.h b/isys/isys.h
index 15e461e..e49347a 100644
--- a/isys/isys.h
+++ b/isys/isys.h
@@ -20,8 +20,9 @@
 #ifndef H_ISYS
 #define H_ISYS
 
-#define MIN_RAM			131072
-#define MIN_GUI_RAM		393216
+#define MIN_RAM			262144 // 256 MB
+#define MIN_GUI_RAM		524288 // 512 MB
+#define URL_INSTALL_EXTRA_RAM   131072 // 128 MB
 #define EARLY_SWAP_RAM		524288
 
 #define OUTPUT_TERMINAL "/dev/tty5"
diff --git a/isys/isys.py b/isys/isys.py
index 8c1e2a1..afa93d4 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -61,6 +61,7 @@ mountCount = {}
 
 MIN_RAM = _isys.MIN_RAM
 MIN_GUI_RAM = _isys.MIN_GUI_RAM
+URL_INSTALL_EXTRA_RAM = _isys.URL_INSTALL_EXTRA_RAM
 EARLY_SWAP_RAM = _isys.EARLY_SWAP_RAM
 
 ## Get the amount of free space available under a directory path.
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux