This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2104852 - [memtune] qemu process limit is not updated after updating vm memory hard_limit at run-time
Summary: [memtune] qemu process limit is not updated after updating vm memory hard_lim...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: liang cong
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-07 10:12 UTC by Fangge Jin
Modified: 2023-07-07 20:31 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-07 20:31:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-739 0 None None None 2023-07-07 20:31:36 UTC
Red Hat Issue Tracker RHELPLAN-127194 0 None None None 2022-07-07 10:18:03 UTC

Description Fangge Jin 2022-07-07 10:12:26 UTC
Description of problem:
Start vm, update vm memory hard_limit by "virsh memtune <domain> --hard-limit <n>" at run-time. Then check qemu process limit by "prlimit", the hard limit is not updated accordingly.
If I set hard_limit in vm xml when vm is shutoff, then start vm. The hard limit printed by prlimit will be same as the hard_limit setting in vm xml.
I'm not sure which one is expected, but the above two behaviors are not consistent.

Version-Release number of selected component:
libvirt-8.5.0-1.el9.x86_64
qemu-kvm-7.0.0-8.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start a vm

2. Check qemu process memory hard limit, it seems the default value is 64M if no hard_limit is set in vm xml:
    # prlimit -p `pidof qemu-kvm` -l
    RESOURCE DESCRIPTION                            SOFT     HARD UNITS
    MEMLOCK  max locked-in-memory address space 67108864 67108864 bytes

3. Update vm memory hard_limit: 
    # virsh memtune uefi  --hard-limit 262144
    # virsh memtune uefi  
       hard_limit     : 262144
       soft_limit     : unlimited
       swap_hard_limit: unlimited
    # virsh dumpxml uefi |grep limit
       <hard_limit unit='KiB'>262144</hard_limit>

4. Check qemu process memory hard limit:
    # prlimit -p `pidof qemu-kvm` -l
    RESOURCE DESCRIPTION                            SOFT     HARD UNITS
    MEMLOCK  max locked-in-memory address space 67108864 67108864 bytes

Actual results:
As above

Comment 1 Peter Krempa 2022-07-12 11:14:38 UTC
Note that the 'max locked-in memory' size obtained by prlimit is not exactly the memory hard limit. The value obtained by prlimit is the maximum memory the process can decide to lock into memory, while the hard limit is the amount of memory the guest can use.

Said that, we actually allow the guest to lock memory up to the 'hard_limit' if it is provided and the 'prlimit' system function seems to allow changing it for an existing process so we can actually consider changing it if the memory hard limit is being modified.

Comment 2 Fangge Jin 2022-07-14 10:53:39 UTC
(In reply to Peter Krempa from comment #1)
> Note that the 'max locked-in memory' size obtained by prlimit is not exactly
> the memory hard limit. The value obtained by prlimit is the maximum memory
> the process can decide to lock into memory, while the hard limit is the
> amount of memory the guest can use.
> 
> Said that, we actually allow the guest to lock memory up to the 'hard_limit'
> if it is provided and the 'prlimit' system function seems to allow changing
> it for an existing process so we can actually consider changing it if the
> memory hard limit is being modified.

Thanks for you explanation, I understand the difference of "max locked-in memory" and "max used host memory" now.
Now I think we should not change the value of "max locked-in memory" unless it is needed(e.g. when do zerocopy/rdma migration)


Note You need to log in before you can comment on or make changes to this bug.