summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-01-15 19:53:49 +0100
committerwanchao-xu <wanchao.xu@samsung.com>2024-01-09 19:38:07 +0800
commitd75a6a651c4e9172e63a097a432de5664c1208d1 (patch)
treebeb9c3ca179f8da2cf2653f79e28c59a692b5a3d /vl.c
parent64a019f65088406efc96383f25d2036368b94697 (diff)
downloadqemu-arm-static-d75a6a651c4e9172e63a097a432de5664c1208d1.tar.gz
qemu-arm-static-d75a6a651c4e9172e63a097a432de5664c1208d1.tar.bz2
qemu-arm-static-d75a6a651c4e9172e63a097a432de5664c1208d1.zip
Raise soft address space limit to hard limit
For SLES we want users to be able to use large memory configurations with KVM without fiddling with ulimit -Sv. Signed-off-by: Andreas Färber <afaerber@suse.de> [BR: add include for sys/resource.h] Signed-off-by: Bruce Rogers <brogers@suse.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index bf0a6345d..68de8184f 100644
--- a/vl.c
+++ b/vl.c
@@ -33,6 +33,7 @@
#include "qemu/uuid.h"
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
+#include <sys/resource.h>
#include "sysemu/seccomp.h"
#include "sysemu/tcg.h"
@@ -2863,6 +2864,7 @@ int main(int argc, char **argv, char **envp)
char *dir, **dirs;
BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list);
+ struct rlimit rlimit_as;
os_set_line_buffering();
@@ -2874,6 +2876,16 @@ int main(int argc, char **argv, char **envp)
qemu_mutex_lock_iothread();
+ /*
+ * Try to raise the soft address space limit.
+ * Default on SLES 11 SP2 is 80% of physical+swap memory.
+ */
+ getrlimit(RLIMIT_AS, &rlimit_as);
+ if (rlimit_as.rlim_cur < rlimit_as.rlim_max) {
+ rlimit_as.rlim_cur = rlimit_as.rlim_max;
+ setrlimit(RLIMIT_AS, &rlimit_as);
+ }
+
atexit(qemu_run_exit_notifiers);
qemu_init_exec_dir(argv[0]);