42aeb20e68
Update to v5.0.0 OBS-URL: https://build.opensuse.org/request/show/798748 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=547
55 lines
1.7 KiB
Diff
55 lines
1.7 KiB
Diff
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
|
|
Date: Sun, 15 Jan 2012 19:53:49 +0100
|
|
Subject: Raise soft address space limit to hard limit
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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>
|
|
---
|
|
softmmu/vl.c | 12 ++++++++++++
|
|
1 file changed, 12 insertions(+)
|
|
|
|
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
|
index 32c004788919e4f50b4bfc88113b..97e3888e832f0c9051f720bb701c 100644
|
|
--- a/softmmu/vl.c
|
|
+++ b/softmmu/vl.c
|
|
@@ -34,6 +34,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"
|
|
|
|
@@ -2851,6 +2852,7 @@ void qemu_init(int argc, char **argv, char **envp)
|
|
BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
|
|
QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list);
|
|
int mem_prealloc = 0; /* force preallocation of physical target memory */
|
|
+ struct rlimit rlimit_as;
|
|
|
|
os_set_line_buffering();
|
|
|
|
@@ -2862,6 +2864,16 @@ void qemu_init(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]);
|
|
|