xen-mapcache: Fix rlimit set size.

Previously, the address space soft limit was set mcache_max_size. So,
before the mcache_max_size was reached by the mapcache, QEMU was killed
for overuse of the virtual address space.

This patch fix that by setting the soft limit the maximum than can have
QEMU. So the soft and hard limit are always set to RLIM_INFINITY if QEMU
is privileged.

In case QEMU is not run as root and the limit is too low, the maximum
mapcache size will be set the rlim_max - 80MB because observed that QEMU
use 75MB more than the maximum mapcache size after several empirical
tests.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
1 file changed
tree: 13a7e2c05943a89401ba9c2012ded94726e8d969
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. libcacard/
  12. linux-headers/
  13. linux-user/
  14. net/
  15. pc-bios/
  16. qapi/
  17. qga/
  18. QMP/
  19. roms/
  20. scripts/
  21. slirp/
  22. sysconfigs/
  23. target-alpha/
  24. target-arm/
  25. target-cris/
  26. target-i386/
  27. target-lm32/
  28. target-m68k/
  29. target-microblaze/
  30. target-mips/
  31. target-ppc/
  32. target-s390x/
  33. target-sh4/
  34. target-sparc/
  35. target-unicore32/
  36. tcg/
  37. tests/
  38. trace/
  39. ui/
  40. .gitignore
  41. .gitmodules
  42. a.out.h
  43. acl.c
  44. acl.h
  45. aes.c
  46. aes.h
  47. aio.c
  48. alpha-dis.c
  49. alpha.ld
  50. arch_init.c
  51. arch_init.h
  52. arm-dis.c
  53. arm-semi.c
  54. arm.ld
  55. async.c
  56. balloon.c
  57. balloon.h
  58. bitmap.c
  59. bitmap.h
  60. bitops.c
  61. bitops.h
  62. block-migration.c
  63. block-migration.h
  64. block.c
  65. block.h
  66. block_int.h
  67. blockdev.c
  68. blockdev.h
  69. bswap.h
  70. bt-host.c
  71. bt-host.h
  72. bt-vhci.c
  73. buffered_file.c
  74. buffered_file.h
  75. cache-utils.c
  76. cache-utils.h
  77. Changelog
  78. check-qdict.c
  79. check-qfloat.c
  80. check-qint.c
  81. check-qjson.c
  82. check-qlist.c
  83. check-qstring.c
  84. cmd.c
  85. cmd.h
  86. CODING_STYLE
  87. compatfd.c
  88. compatfd.h
  89. compiler.h
  90. config.h
  91. configure
  92. console.c
  93. console.h
  94. COPYING
  95. COPYING.LIB
  96. coroutine-gthread.c
  97. coroutine-ucontext.c
  98. coroutine-win32.c
  99. cpu-all.h
  100. cpu-common.h
  101. cpu-defs.h
  102. cpu-exec.c
  103. cpus.c
  104. cpus.h
  105. cris-dis.c
  106. cursor.c
  107. cursor_hidden.xpm
  108. cursor_left_ptr.xpm
  109. cutils.c
  110. def-helper.h
  111. device_tree.c
  112. device_tree.h
  113. dis-asm.h
  114. disas.c
  115. disas.h
  116. dma-helpers.c
  117. dma.h
  118. dyngen-exec.h
  119. elf.h
  120. envlist.c
  121. envlist.h
  122. error.c
  123. error.h
  124. error_int.h
  125. exec-all.h
  126. exec-memory.h
  127. exec.c
  128. gdbstub.c
  129. gdbstub.h
  130. gen-icount.h
  131. HACKING
  132. hmp-commands.hx
  133. host-utils.c
  134. host-utils.h
  135. hpet.h
  136. hppa-dis.c
  137. hppa.ld
  138. i386-dis.c
  139. i386.ld
  140. ia64-dis.c
  141. ia64.ld
  142. input.c
  143. iohandler.c
  144. ioport-user.c
  145. ioport.c
  146. ioport.h
  147. iorange.h
  148. iov.c
  149. iov.h
  150. json-lexer.c
  151. json-lexer.h
  152. json-parser.c
  153. json-parser.h
  154. json-streamer.c
  155. json-streamer.h
  156. kvm-all.c
  157. kvm-stub.c
  158. kvm.h
  159. libfdt_env.h
  160. LICENSE
  161. linux-aio.c
  162. m68k-dis.c
  163. m68k-semi.c
  164. m68k.ld
  165. MAINTAINERS
  166. Makefile
  167. Makefile.dis
  168. Makefile.hw
  169. Makefile.objs
  170. Makefile.target
  171. Makefile.user
  172. memory.c
  173. memory.h
  174. microblaze-dis.c
  175. migration-exec.c
  176. migration-fd.c
  177. migration-tcp.c
  178. migration-unix.c
  179. migration.c
  180. migration.h
  181. mips-dis.c
  182. mips.ld
  183. module.c
  184. module.h
  185. monitor.c
  186. monitor.h
  187. nbd.c
  188. nbd.h
  189. net.c
  190. net.h
  191. notify.c
  192. notify.h
  193. os-posix.c
  194. os-win32.c
  195. osdep.c
  196. osdep.h
  197. oslib-posix.c
  198. oslib-win32.c
  199. path.c
  200. pci-ids.txt
  201. pflib.c
  202. pflib.h
  203. poison.h
  204. posix-aio-compat.c
  205. ppc-dis.c
  206. ppc.ld
  207. ppc64.ld
  208. qapi-schema-guest.json
  209. qapi-schema-test.json
  210. qbool.c
  211. qbool.h
  212. qdict-test-data.txt
  213. qdict.c
  214. qdict.h
  215. qemu-aio.h
  216. qemu-barrier.h
  217. qemu-char.c
  218. qemu-char.h
  219. qemu-common.h
  220. qemu-config.c
  221. qemu-config.h
  222. qemu-coroutine-int.h
  223. qemu-coroutine-lock.c
  224. qemu-coroutine.c
  225. qemu-coroutine.h
  226. qemu-doc.texi
  227. qemu-error.c
  228. qemu-error.h
  229. qemu-ga.c
  230. qemu-img-cmds.hx
  231. qemu-img.c
  232. qemu-img.texi
  233. qemu-io.c
  234. qemu-lock.h
  235. qemu-log.h
  236. qemu-nbd.c
  237. qemu-nbd.texi
  238. qemu-objects.h
  239. qemu-option.c
  240. qemu-option.h
  241. qemu-options.h
  242. qemu-options.hx
  243. qemu-os-posix.h
  244. qemu-os-win32.h
  245. qemu-progress.c
  246. qemu-queue.h
  247. qemu-sockets.c
  248. qemu-tech.texi
  249. qemu-thread-posix.c
  250. qemu-thread-posix.h
  251. qemu-thread-win32.c
  252. qemu-thread-win32.h
  253. qemu-thread.h
  254. qemu-timer-common.c
  255. qemu-timer.c
  256. qemu-timer.h
  257. qemu-tool.c
  258. qemu-x509.h
  259. qemu.sasl
  260. qemu_socket.h
  261. qerror.c
  262. qerror.h
  263. qfloat.c
  264. qfloat.h
  265. qint.c
  266. qint.h
  267. qjson.c
  268. qjson.h
  269. qlist.c
  270. qlist.h
  271. qmp-commands.hx
  272. qobject.h
  273. qstring.c
  274. qstring.h
  275. range.h
  276. readline.c
  277. readline.h
  278. README
  279. rules.mak
  280. s390-dis.c
  281. s390.ld
  282. savevm.c
  283. sh4-dis.c
  284. softmmu-semi.h
  285. softmmu_defs.h
  286. softmmu_exec.h
  287. softmmu_header.h
  288. softmmu_template.h
  289. sparc-dis.c
  290. sparc.ld
  291. sparc64.ld
  292. spice-qemu-char.c
  293. sysemu.h
  294. targphys.h
  295. tcg-runtime.c
  296. test-coroutine.c
  297. test-qmp-commands.c
  298. test-visitor.c
  299. thunk.c
  300. thunk.h
  301. TODO
  302. trace-events
  303. translate-all.c
  304. uboot_image.h
  305. usb-bsd.c
  306. usb-linux.c
  307. usb-redir.c
  308. usb-stub.c
  309. user-exec.c
  310. VERSION
  311. version.rc
  312. vgafont.h
  313. vl.c
  314. x86_64.ld
  315. xen-all.c
  316. xen-mapcache.c
  317. xen-mapcache.h
  318. xen-stub.c