aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init/Config.in8
-rw-r--r--init/init.c6
2 files changed, 14 insertions, 0 deletions
diff --git a/init/Config.in b/init/Config.in
index 4465e75a1..521f8fe1d 100644
--- a/init/Config.in
+++ b/init/Config.in
@@ -35,6 +35,14 @@ config CONFIG_FEATURE_INIT_COREDUMPS
35 core file sizes. If this option is disabled, processes 35 core file sizes. If this option is disabled, processes
36 will not generate any core files. 36 will not generate any core files.
37 37
38config CONFIG_FEATURE_INIT_SWAPON
39 bool " Should init run swapon if short on memory?"
40 default y
41 depends on CONFIG_INIT
42 help
43 If the system has less than one megabyte of total memory, init
44 will run '/sbin/swapon -a' to add swap memory.
45
38config CONFIG_FEATURE_EXTRA_QUIET 46config CONFIG_FEATURE_EXTRA_QUIET
39 bool " Should init be _extra_ quiet on boot?" 47 bool " Should init be _extra_ quiet on boot?"
40 default y 48 default y
diff --git a/init/init.c b/init/init.c
index e0e2f19fb..528122580 100644
--- a/init/init.c
+++ b/init/init.c
@@ -309,6 +309,7 @@ static void set_term(int fd)
309 tcsetattr(fd, TCSANOW, &tty); 309 tcsetattr(fd, TCSANOW, &tty);
310} 310}
311 311
312#ifdef CONFIG_FEATURE_INIT_SWAPON
312/* How much memory does this machine have? 313/* How much memory does this machine have?
313 Units are kBytes to avoid overflow on 4GB machines */ 314 Units are kBytes to avoid overflow on 4GB machines */
314static unsigned int check_free_memory(void) 315static unsigned int check_free_memory(void)
@@ -337,6 +338,7 @@ static unsigned int check_free_memory(void)
337 return(result * u); 338 return(result * u);
338 } 339 }
339} 340}
341#endif /* CONFIG_FEATURE_INIT_SWAPON */
340 342
341static void console_init(void) 343static void console_init(void)
342{ 344{
@@ -910,6 +912,7 @@ static void delete_init_action(struct init_action *action)
910 } 912 }
911} 913}
912 914
915#ifdef CONFIG_FEATURE_INIT_SWAPON
913/* Make sure there is enough memory to do something useful. * 916/* Make sure there is enough memory to do something useful. *
914 * Calls "swapon -a" if needed so be sure /etc/fstab is present... */ 917 * Calls "swapon -a" if needed so be sure /etc/fstab is present... */
915static void check_memory(void) 918static void check_memory(void)
@@ -937,6 +940,9 @@ static void check_memory(void)
937 message(CONSOLE, "Sorry, your computer does not have enough memory."); 940 message(CONSOLE, "Sorry, your computer does not have enough memory.");
938 loop_forever(); 941 loop_forever();
939} 942}
943#else
944# define check_memory()
945#endif /* CONFIG_FEATURE_INIT_SWAPON */
940 946
941/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, 947/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
942 * then parse_inittab() simply adds in some default 948 * then parse_inittab() simply adds in some default