char *kernel = NULL, *initrd = NULL;
char unixsock[256];
struct sockaddr_un addr;
- struct stat statbuf;
/* Configured? */
if (!g->cmdline) {
goto cleanup0;
}
- /* Choose a suitable memory size (in MB). This is more art
- * than science, but you can help by doing
- * ./configure --enable-debug-command
- * and then running:
- * debug sh free
- * debug mem ''
- * and seeing how much free memory is left for particular
- * configurations.
- *
- * It's also helpful to report both the compressed and uncompressed
- * size of the initramfs (ls -lh initramfs*.img; du -sh initramfs).
- *
- * XXX KVM virtio balloon driver?
+ /* Choose a suitable memory size. Previously we tried to choose
+ * a minimal memory size, but this isn't really necessary since
+ * recent QEMU and KVM don't do anything nasty like locking
+ * memory into core any more. This we can safely choose a
+ * large, generous amount of memory, and it'll just get swapped
+ * on smaller systems.
*/
- if (stat (initrd, &statbuf) != -1) {
- /* Approximate size of the initramfs after it is decompressed
- * in kernel memory. The compression factor is ~2.5-3.
- */
- memsize = 3 * statbuf.st_size / 1024 / 1024;
-
- /* Approximate size used by the kernel. */
- memsize += 10;
-
- /* Want to give userspace some room, so: */
- memsize += 128;
-
-#if SIZEOF_LONG == 8
- /* On 64 bit, assume some overhead. */
- memsize += 64;
-#endif
- } else
- memsize = 512;
-
+ memsize = 384;
/* Make the temporary directory containing the socket. */
if (!g->tmpdir) {