pve-qemu-qoup/debian/patches/pve
Fiona Ebner 5f9cb29c3a backup: trim heap after finishing
Reported in the community forum [0]. By default, there can be large
amounts of memory left assigned to the QEMU process after backup.
Likely because of fragmentation, it's necessary to explicitly call
malloc_trim() to tell glibc that it shouldn't keep all that memory
resident for the process.

QEMU itself already does a malloc_trim() in the RCU thread, but that
code path might not be reached (or not for a long time) under usual
operation. The value of 4 MiB for the argument was also copied from
there.

Example with the following configuration:
> agent: 1
> boot: order=scsi0
> cores: 4
> cpu: x86-64-v2-AES
> ide2: none,media=cdrom
> memory: 1024
> name: backup-mem
> net0: virtio=DA:58:18:26:59:9F,bridge=vmbr0,firewall=1
> numa: 0
> ostype: l26
> scsi0: rbd:base-107-disk-0/vm-106-disk-1,size=4302M
> scsihw: virtio-scsi-pci
> smbios1: uuid=b2d4511e-8d01-44f1-afd6-9581b30c24a6
> sockets: 2
> startup: order=2
> virtio0: lvmthin:vm-106-disk-1,iothread=1,size=1G
> virtio1: lvmthin:vm-106-disk-2,iothread=1,size=1G
> virtio2: lvmthin:vm-106-disk-3,iothread=1,size=1G
> vmgenid: 0a1d8751-5e02-449d-977e-c0160e900231

Before the change:

> root@pve8a1 ~ # grep VmRSS /proc/$(cat /var/run/qemu-server/106.pid)/status
> VmRSS:	  370948 kB
> root@pve8a1 ~ # vzdump 106 --storage pbs
> (...)
> INFO: Backup job finished successfully
> root@pve8a1 ~ # grep VmRSS /proc/$(cat /var/run/qemu-server/106.pid)/status
> VmRSS:	 2114964 kB

After the change:

> root@pve8a1 ~ # grep VmRSS /proc/$(cat /var/run/qemu-server/106.pid)/status
> VmRSS:	  398788 kB
> root@pve8a1 ~ # vzdump 106 --storage pbs
> (...)
> INFO: Backup job finished successfully
> root@pve8a1 ~ # grep VmRSS /proc/$(cat /var/run/qemu-server/106.pid)/status
> VmRSS:	  424356 kB

[0]: https://forum.proxmox.com/threads/131339/

Co-diagnosed-by: Friedrich Weber <f.weber@proxmox.com>
Co-diagnosed-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-16 11:50:12 +02:00
..
0001-PVE-Config-block-file-change-locking-default-to-off.patch update submodule and patches to QEMU 8.0.0 2023-05-22 15:09:14 +02:00
0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch update submodule and patches to QEMU 8.0.0 2023-05-22 15:09:14 +02:00
0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch update submodule and patches to QEMU 8.0.0 2023-05-22 15:09:14 +02:00
0004-PVE-Config-ui-spice-default-to-pve-certificates.patch update submodule and patches to QEMU 8.0.0 2023-05-22 15:09:14 +02:00
0005-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch update submodule and patches to QEMU 8.0.0 2023-05-22 15:09:14 +02:00
0006-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch update submodule and patches to QEMU 8.0.0 2023-05-22 15:09:14 +02:00
0007-PVE-Up-glusterfs-allow-partial-reads.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0008-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0009-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0010-PVE-Up-qemu-img-dd-add-isize-parameter.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0011-PVE-Up-qemu-img-dd-add-n-skip_create.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0012-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0013-PVE-virtio-balloon-improve-query-balloon.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0014-PVE-qapi-modify-query-machines.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0015-PVE-qapi-modify-spice-query.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0016-PVE-add-IOChannel-implementation-for-savevm-async.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0017-PVE-add-savevm-async-for-background-state-snapshots.patch refresh patch context 2023-08-16 11:50:08 +02:00
0018-PVE-add-optional-buffer-size-to-QEMUFile.patch refresh patch context 2023-08-16 11:50:08 +02:00
0019-PVE-block-add-the-zeroinit-block-driver-filter.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0020-PVE-Add-dummy-id-command-line-parameter.patch regenerate patches 2023-06-15 13:55:22 +02:00
0021-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0023-PVE-monitor-disable-oob-capability.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch regenerate patches 2023-06-15 13:55:22 +02:00
0025-PVE-Allow-version-code-in-machine-type.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0026-block-backup-move-bcs-bitmap-initialization-to-job-c.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0027-PVE-Backup-add-vma-backup-format-code.patch refresh patch context 2023-08-16 11:50:08 +02:00
0028-PVE-Backup-add-backup-dump-block-driver.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0029-PVE-Add-sequential-job-transaction-support.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0030-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch backup: trim heap after finishing 2023-08-16 11:50:12 +02:00
0031-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch regenerate patches 2023-06-15 13:55:22 +02:00
0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch regenerate patches 2023-06-15 13:55:22 +02:00
0033-PVE-redirect-stderr-to-journal-when-daemonized.patch regenerate patches 2023-06-15 13:55:22 +02:00
0034-PVE-Migrate-dirty-bitmap-state-via-savevm.patch backup: trim heap after finishing 2023-08-16 11:50:12 +02:00
0035-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch add patch fixing resume for snapshot and hibernate with drive with iothread and a dirty bitmap 2023-07-28 12:00:50 +02:00
0036-PVE-fall-back-to-open-iscsi-initiatorname.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0037-PVE-block-stream-increase-chunk-size.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0038-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0039-block-add-alloc-track-driver.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0040-Revert-block-rbd-workaround-for-ceph-issue-53784.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0041-Revert-block-rbd-fix-handling-of-holes-in-.bdrv_co_b.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0042-Revert-block-rbd-implement-bdrv_co_block_status.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0043-alloc-track-fix-deadlock-during-drop.patch drop patch for custom get_link_status QMP command 2023-06-07 19:35:40 +02:00
0044-migration-for-snapshots-hold-the-BQL-during-setup-ca.patch add patch fixing resume for snapshot and hibernate with drive with iothread and a dirty bitmap 2023-07-28 12:00:50 +02:00
0045-savevm-async-don-t-hold-BQL-during-setup.patch refresh patch context 2023-08-16 11:50:08 +02:00