Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB

  1. Home
  2. uncategorized
  3. There's something that's eating quite a lot of RAM when using my Windows VM in QEMU.

There's something that's eating quite a lot of RAM when using my Windows VM in QEMU.

Scheduled Pinned Locked Moved uncategorized
13 Posts 5 Posters 69 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • volpeon@icy.wyvern.ripV volpeon@icy.wyvern.rip

    At start, I was at ~15gb and nothing in swap. After QEMU it's this and I got lag because of the swapping. Why. Process managers don't show me any process using this much.

    anthropy@mastodon.derg.nzA This user is from outside of this forum
    anthropy@mastodon.derg.nzA This user is from outside of this forum
    anthropy@mastodon.derg.nz
    wrote last edited by
    #4

    @volpeon strange! is ballooning set on the VM? How much RAM did you allocate to it?

    volpeon@icy.wyvern.ripV 1 Reply Last reply
    0
    • volpeon@icy.wyvern.ripV volpeon@icy.wyvern.rip

      At start, I was at ~15gb and nothing in swap. After QEMU it's this and I got lag because of the swapping. Why. Process managers don't show me any process using this much.

      wakame@tech.lgbtW This user is from outside of this forum
      wakame@tech.lgbtW This user is from outside of this forum
      wakame@tech.lgbt
      wrote last edited by
      #5

      @volpeon Maybe some ballooning thing?
      The Windows VM might claim as much RAM as you give it.
      And maybe that memory is still reserved for a while after you stop QEMU?

      1 Reply Last reply
      0
      • volpeon@icy.wyvern.ripV volpeon@icy.wyvern.rip

        At start, I was at ~15gb and nothing in swap. After QEMU it's this and I got lag because of the swapping. Why. Process managers don't show me any process using this much.

        kura@hai.z0ne.socialK This user is from outside of this forum
        kura@hai.z0ne.socialK This user is from outside of this forum
        kura@hai.z0ne.social
        wrote last edited by
        #6

        @volpeon@icy.wyvern.rip my native win 11 work laptop uses 32+gb ram. When I manually count using task manager I can't even reach half of that.

        So I'd say, Windows is the reason.

        volpeon@icy.wyvern.ripV 1 Reply Last reply
        0
        • kura@hai.z0ne.socialK kura@hai.z0ne.social

          @volpeon@icy.wyvern.rip my native win 11 work laptop uses 32+gb ram. When I manually count using task manager I can't even reach half of that.

          So I'd say, Windows is the reason.

          volpeon@icy.wyvern.ripV This user is from outside of this forum
          volpeon@icy.wyvern.ripV This user is from outside of this forum
          volpeon@icy.wyvern.rip
          wrote last edited by
          #7

          @kura But how would Windows even be able to go beyond the 32gb RAM I allocated? 32gb is immediately gone, but there's about 20gb that gets used on top of that and it only returns long after I stopped QEMU.

          kura@hai.z0ne.socialK 1 Reply Last reply
          0
          • volpeon@icy.wyvern.ripV volpeon@icy.wyvern.rip

            @kura But how would Windows even be able to go beyond the 32gb RAM I allocated? 32gb is immediately gone, but there's about 20gb that gets used on top of that and it only returns long after I stopped QEMU.

            kura@hai.z0ne.socialK This user is from outside of this forum
            kura@hai.z0ne.socialK This user is from outside of this forum
            kura@hai.z0ne.social
            wrote last edited by
            #8

            @volpeon@icy.wyvern.rip that I cannot answer.

            I do my very best to avoid windows. So I unlearned almost everything Windows I knew.

            1 Reply Last reply
            0
            • anthropy@mastodon.derg.nzA anthropy@mastodon.derg.nz

              @volpeon strange! is ballooning set on the VM? How much RAM did you allocate to it?

              volpeon@icy.wyvern.ripV This user is from outside of this forum
              volpeon@icy.wyvern.ripV This user is from outside of this forum
              volpeon@icy.wyvern.rip
              wrote last edited by
              #9

              @anthropy I allocated 32gb. I'm not sure about ballooning, but here's the command I use:

              taskset -c ${CPU_CORE} qemu-system-x86_64 \
                 -name "Windows 10" \
                 -machine q35,mem-merge=off,vmport=off \
                 -accel kvm \
                 -accel kvm,kernel-irqchip=on \
                 -cpu host,+topoext,kvm=off,hv_spinlocks=0x1fff,hv_relaxed,hv_vapic,hv_time,hv_crash,hv_reset,hv_vpindex,hv_runtime,hv_synic,hv_stimer,hv_vendor_id=Gigabyte \
                 -smp 12,sockets=1,cores=6,threads=2 \
                 -global ICH9-LPC.disable_s3=1 \
                 -global ICH9-LPC.disable_s4=1 \
                 -m ${RAM_SIZE} \
                 -mem-prealloc \
                 -rtc clock=host,base=localtime,driftfix=slew \
                 -global kvm-pit.lost_tick_policy=delay \
                 -overcommit mem-lock=off \
                 -global kvm-pit.lost_tick_policy=discard \
                 -nographic \
                 -vga none \
                 -serial none \
                 -parallel none \
                 -k en-us \
                 -msg timestamp=on \
                 -spice port=${SPICE_PORT},disable-ticketing=on \
                 -usb \
                 -audio driver=pipewire,model=hda,id=snd1 \
                 -device ioh3420,chassis=1,bus=pcie.0,addr=03.0,id=ioh3420-root-port-1 \
                 -device ivshmem-plain,memdev=ivshmem,bus=pcie.0 \
                 -object memory-backend-file,id=ivshmem,share=on,mem-path=/dev/shm/looking-glass,size=128M \
                 -chardev socket,id=chrtpm,path=/var/run/emulated_tpm/swtpm-sock \
                 -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 \
                 -object iothread,id=iothread0 \
                 -netdev bridge,id=virbr0 \
                 -device virtio-net-pci,netdev=virbr0,id=nic1 \
                 -object input-linux,id=kbd1,evdev=${EV_KBD},grab_all=on,repeat=on,grab-toggle=alt-alt \
                 -object input-linux,id=mouse1,evdev=${EV_MOUSE} \
                 -device virtio-mouse-pci \
                 -device virtio-keyboard-pci \
                 -device vfio-pci,host=${VGA_ADDR},bus=ioh3420-root-port-1,addr=00.0,x-pci-sub-device-id=${VGA_SSID},x-pci-sub-vendor-id=${VGA_SVID},multifunction=on,x-vga=on \
                 -drive file=${KVM_CODE},if=pflash,format=raw,unit=0,readonly=on \
                 -drive file=${KVM_VARS},if=pflash,format=raw,unit=1 \
                 -device virtio-scsi-pci,iothread=iothread0,num_queues=8,id=scsi \
                 -drive file="${KVM_DISK}",index=0,media=disk,format=raw,if=none,aio=native,cache.direct=on,id=disk \
                 -drive file="${KVM_DISK_2}",index=1,media=disk,format=raw,if=none,aio=native,cache.direct=on,id=disk2 \
                 -device scsi-hd,drive=disk \
                 -device scsi-hd,drive=disk2 \
                 -drive file="${KVM_OPTI}",index=1,media=cdrom \
                 -drive file="${KVM_CDRV}",index=2,media=cdrom \
                 -device usb-tablet ${USB_DEVS} \
                 -boot menu=on \
                 -chardev stdio,mux=on,id=monitor-0 \
                 -mon chardev=monitor-0 \
                 -chardev socket,id=char0,path=/tmp/vhostqemu \
                 -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=Host \
                 -object memory-backend-memfd,id=vfsmem,size=${RAM_SIZE},share=on \
                 -numa node,memdev=vfsmem

              volpeon@icy.wyvern.ripV 1 Reply Last reply
              0
              • volpeon@icy.wyvern.ripV volpeon@icy.wyvern.rip

                @anthropy I allocated 32gb. I'm not sure about ballooning, but here's the command I use:

                taskset -c ${CPU_CORE} qemu-system-x86_64 \
                   -name "Windows 10" \
                   -machine q35,mem-merge=off,vmport=off \
                   -accel kvm \
                   -accel kvm,kernel-irqchip=on \
                   -cpu host,+topoext,kvm=off,hv_spinlocks=0x1fff,hv_relaxed,hv_vapic,hv_time,hv_crash,hv_reset,hv_vpindex,hv_runtime,hv_synic,hv_stimer,hv_vendor_id=Gigabyte \
                   -smp 12,sockets=1,cores=6,threads=2 \
                   -global ICH9-LPC.disable_s3=1 \
                   -global ICH9-LPC.disable_s4=1 \
                   -m ${RAM_SIZE} \
                   -mem-prealloc \
                   -rtc clock=host,base=localtime,driftfix=slew \
                   -global kvm-pit.lost_tick_policy=delay \
                   -overcommit mem-lock=off \
                   -global kvm-pit.lost_tick_policy=discard \
                   -nographic \
                   -vga none \
                   -serial none \
                   -parallel none \
                   -k en-us \
                   -msg timestamp=on \
                   -spice port=${SPICE_PORT},disable-ticketing=on \
                   -usb \
                   -audio driver=pipewire,model=hda,id=snd1 \
                   -device ioh3420,chassis=1,bus=pcie.0,addr=03.0,id=ioh3420-root-port-1 \
                   -device ivshmem-plain,memdev=ivshmem,bus=pcie.0 \
                   -object memory-backend-file,id=ivshmem,share=on,mem-path=/dev/shm/looking-glass,size=128M \
                   -chardev socket,id=chrtpm,path=/var/run/emulated_tpm/swtpm-sock \
                   -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 \
                   -object iothread,id=iothread0 \
                   -netdev bridge,id=virbr0 \
                   -device virtio-net-pci,netdev=virbr0,id=nic1 \
                   -object input-linux,id=kbd1,evdev=${EV_KBD},grab_all=on,repeat=on,grab-toggle=alt-alt \
                   -object input-linux,id=mouse1,evdev=${EV_MOUSE} \
                   -device virtio-mouse-pci \
                   -device virtio-keyboard-pci \
                   -device vfio-pci,host=${VGA_ADDR},bus=ioh3420-root-port-1,addr=00.0,x-pci-sub-device-id=${VGA_SSID},x-pci-sub-vendor-id=${VGA_SVID},multifunction=on,x-vga=on \
                   -drive file=${KVM_CODE},if=pflash,format=raw,unit=0,readonly=on \
                   -drive file=${KVM_VARS},if=pflash,format=raw,unit=1 \
                   -device virtio-scsi-pci,iothread=iothread0,num_queues=8,id=scsi \
                   -drive file="${KVM_DISK}",index=0,media=disk,format=raw,if=none,aio=native,cache.direct=on,id=disk \
                   -drive file="${KVM_DISK_2}",index=1,media=disk,format=raw,if=none,aio=native,cache.direct=on,id=disk2 \
                   -device scsi-hd,drive=disk \
                   -device scsi-hd,drive=disk2 \
                   -drive file="${KVM_OPTI}",index=1,media=cdrom \
                   -drive file="${KVM_CDRV}",index=2,media=cdrom \
                   -device usb-tablet ${USB_DEVS} \
                   -boot menu=on \
                   -chardev stdio,mux=on,id=monitor-0 \
                   -mon chardev=monitor-0 \
                   -chardev socket,id=char0,path=/tmp/vhostqemu \
                   -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=Host \
                   -object memory-backend-memfd,id=vfsmem,size=${RAM_SIZE},share=on \
                   -numa node,memdev=vfsmem

                volpeon@icy.wyvern.ripV This user is from outside of this forum
                volpeon@icy.wyvern.ripV This user is from outside of this forum
                volpeon@icy.wyvern.rip
                wrote last edited by
                #10

                @anthropy I really need to clean this thing up. It grew over the years. ​​

                anthropy@mastodon.derg.nzA 1 Reply Last reply
                0
                • volpeon@icy.wyvern.ripV volpeon@icy.wyvern.rip

                  @anthropy I really need to clean this thing up. It grew over the years. ​​

                  anthropy@mastodon.derg.nzA This user is from outside of this forum
                  anthropy@mastodon.derg.nzA This user is from outside of this forum
                  anthropy@mastodon.derg.nz
                  wrote last edited by
                  #11

                  @volpeon hah it definitely is a sizable command, but that's how that stuff always goes x3 I also see some legacy things that could be skipped or replaced.

                  I see you're telling QEMU twice how memory to use in different ways, I don't know 100% sure if that could cause issues, but you could consider either removing the -m or the `-object memory-backend-memfd` and `-numa` bit, I'd recommend only using -m, unless you specifically want to specify the memory and cpu architecture in non-standard ways.

                  anthropy@mastodon.derg.nzA volpeon@icy.wyvern.ripV 2 Replies Last reply
                  0
                  • anthropy@mastodon.derg.nzA anthropy@mastodon.derg.nz

                    @volpeon hah it definitely is a sizable command, but that's how that stuff always goes x3 I also see some legacy things that could be skipped or replaced.

                    I see you're telling QEMU twice how memory to use in different ways, I don't know 100% sure if that could cause issues, but you could consider either removing the -m or the `-object memory-backend-memfd` and `-numa` bit, I'd recommend only using -m, unless you specifically want to specify the memory and cpu architecture in non-standard ways.

                    anthropy@mastodon.derg.nzA This user is from outside of this forum
                    anthropy@mastodon.derg.nzA This user is from outside of this forum
                    anthropy@mastodon.derg.nz
                    wrote last edited by
                    #12

                    @volpeon maybe it's heresy to say but, I do think this is an excellent use case for an LLM, to clean it up and find the latest variations of everything in there 😛 but that's just my two cents, I think LLMs work great as linters even if they're not 100% accurate

                    1 Reply Last reply
                    0
                    • anthropy@mastodon.derg.nzA anthropy@mastodon.derg.nz

                      @volpeon hah it definitely is a sizable command, but that's how that stuff always goes x3 I also see some legacy things that could be skipped or replaced.

                      I see you're telling QEMU twice how memory to use in different ways, I don't know 100% sure if that could cause issues, but you could consider either removing the -m or the `-object memory-backend-memfd` and `-numa` bit, I'd recommend only using -m, unless you specifically want to specify the memory and cpu architecture in non-standard ways.

                      volpeon@icy.wyvern.ripV This user is from outside of this forum
                      volpeon@icy.wyvern.ripV This user is from outside of this forum
                      volpeon@icy.wyvern.rip
                      wrote last edited by
                      #13

                      @anthropy I added the numa part for virtiofs. Looks weird to me, too, but that's what you're supposed to do according to their docs: virtio-fs.gitlab.io/howto-qemu.html

                      (I only did one thing differently, and that is using memory-backend-memfd instead of memory-backend-file)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      Powered by NodeBB Contributors
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups