SHA256
1
0
forked from pool/qemu
qemu/0034-Raise-soft-address-space-limit-to-h.patch
Bruce Rogers fb435f43f3 Accepting request 493037 from home:bfrogers:branches:Virtualization
Fix build issues for some older distros. Also includes fixing broken parts of spec file when not building x86 firmware.

OBS-URL: https://build.opensuse.org/request/show/493037
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=338
2017-05-05 15:05:43 +00:00

56 lines
1.7 KiB
Diff

From 0b4661283cb4ea49967dd1a9b1f977a4fbc9e804 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Sun, 15 Jan 2012 19:53:49 +0100
Subject: [PATCH] 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>
---
vl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/vl.c b/vl.c
index e0f2ec86a9..caad3f93b3 100644
--- a/vl.c
+++ b/vl.c
@@ -26,6 +26,7 @@
#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "qemu/uuid.h"
+#include <sys/resource.h>
#ifdef CONFIG_SECCOMP
#include "sysemu/seccomp.h"
@@ -2984,6 +2985,7 @@ int main(int argc, char **argv, char **envp)
} BlockdevOptions_queue;
QSIMPLEQ_HEAD(, BlockdevOptions_queue) bdo_queue
= QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
+ struct rlimit rlimit_as;
module_call_init(MODULE_INIT_TRACE);
@@ -2991,6 +2993,16 @@ int main(int argc, char **argv, char **envp)
qemu_init_cpu_loop();
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);
error_set_progname(argv[0]);
qemu_init_exec_dir(argv[0]);