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 950478 - if the value of 'swap-hard-limit' smaller than the existing vaule of 'hard-limit', memtune can not set them together
Summary: if the value of 'swap-hard-limit' smaller than the existing vaule of 'hard-li...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-10 09:57 UTC by EricLee
Modified: 2014-06-18 00:49 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.0.5-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 09:44:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description EricLee 2013-04-10 09:57:48 UTC
Description of problem:
if the value of 'swap-hard-limit' smaller than the existing vaule of 'hard-limit', memtune can not set them together

Version-Release number of selected component (if applicable):
kernel-3.9.0-0.rc6.50.el7.x86_64
libvirt-1.0.4-1.el7.x86_64
qemu-kvm-1.4.0-2.el7.x86_64

Reproduce steps:
1. prepare a healthy guest with os and start guest;

2. # virsh memtune --domain r7 
hard_limit     : 1824256
soft_limit     : unlimited
swap_hard_limit: unlimited

3. # virsh memtune r7 --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000
error: Unable to change memory parameters
error: unable to set memory swap_hard_limit tunable: Invalid argument

4. # virsh memtune r7 --hard-limit 1024000 --soft-limit 1024000

set successfully.

5. # virsh memtune --domain r7
hard_limit     : 1024000
soft_limit     : 1024000
swap_hard_limit: unlimited

6. # virsh memtune r7 --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000

this time will work.

7. # virsh memtune --domain r7
hard_limit     : 1024000
soft_limit     : 1024000
swap_hard_limit: 1024000

8. # virsh memtune r7 --hard-limit 1024008 --soft-limit 102400 --swap-hard-limit 1024008

works well.

9. # virsh memtune --domain r7
hard_limit     : 1024008
soft_limit     : 102400
swap_hard_limit: 1024008

But
10. # virsh memtune r7 --hard-limit 1024000 --swap-hard-limit 1024004
error: Unable to change memory parameters
error: unable to set memory swap_hard_limit tunable: Invalid argument

will not work.

Actual results:
As steps.

Expected results:
should firstly compare the value of 'swap-hard-limit' with the setting value of 'hard-limit', if the former is not bigger, then compare with the existing value of 'hard-limit'.

Additional info:
There is a cgroup problem and have mentioned in:
https://bugzilla.redhat.com/show_bug.cgi?id=839537#c16

We can try:

# virsh list
 Id    Name                           State
----------------------------------------------------
 2     libvirt_test_api               running

write a big limit value in cgroup:
# echo 1073741824000 >/sys/fs/cgroup/memory/libvirt/qemu/libvirt_test_api/memory.limit_in_bytes;echo 1073741824000 >/sys/fs/cgroup/memory/libvirt/qemu/libvirt_test_api/memory.soft_limit_in_bytes;echo 1073741824000 >/sys/fs/cgroup/memory/libvirt/qemu/libvirt_test_api/memory.memsw.limit_in_bytes

# virsh memtune libvirt_test_api
hard_limit     : 1048576000
soft_limit     : 1048576000
swap_hard_limit: 1048576000

then write a smaller value in:
# echo 6542848 >/sys/fs/cgroup/memory/libvirt/qemu/libvirt_test_api/memory.limit_in_bytes;echo 6542848 >/sys/fs/cgroup/memory/libvirt/qemu/libvirt_test_api/memory.soft_limit_in_bytes;echo 6542848 >/sys/fs/cgroup/memory/libvirt/qemu/libvirt_test_api/memory.memsw.limit_in_bytes
-bash: echo: write error: Device or resource busy

# virsh memtune libvirt_test_api
hard_limit     : 6392
soft_limit     : 6392
swap_hard_limit: 1048576000

But the bug has been closed.

Comment 2 Peter Krempa 2013-04-23 05:18:19 UTC
Fixed upstream in v1.0.4-235-gfa006c4 by:

commit fa006c4fdd8c8580bca3db1436e3201350e973f4
Author: Peter Krempa <pkrempa>
Date:   Wed Apr 17 17:50:56 2013 +0200

    qemu: Fix setting of memory tunables
    
    Refactoring done in 19c6ad9ac7e7eb2fd3c8262bff5f087b508ad07f didn't
    correctly take into account the order cgroup limit modification needs to
    be done in. This resulted into errors when decreasing the limits.
    
    The operations need to take place in this order:
    
    decrease hard limit
    change swap hard limit
    
    or
    
    change swap hard limit
    increase hard limit
    
    This patch also fixes the check if the hard_limit is less than
    swap_hard_limit to print better error messages. For this purpose I
    introduced a helper function virCompareLimitUlong to compare limit
    values where value of 0 is equal to unlimited. Additionally the check is
    now applied also when the user does not provide all of the tunables
    through the API and in that case the currently set values are used.
    
    This patch resolves:
    https://bugzilla.redhat.com/show_bug.cgi?id=950478

Comment 3 EricLee 2013-05-06 09:38:58 UTC
Verifying this bug:

Can reproduce this bug on libvirt-1.0.4-1.1.el7.x86_64; And can not reproduce it on libvirt-1.0.5-1.el7:
# virsh start r63
Domain r63 started

# virsh memtune --domain r63
hard_limit     : 1824256
soft_limit     : unlimited
swap_hard_limit: unlimited

1. decrease hard limit and change swap hard limit:
# virsh memtune r63 --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000

# virsh memtune --domain r63
hard_limit     : 1024000
soft_limit     : 1024000
swap_hard_limit: 1024000

working well.

2.change swap hard limit and increase hard limit:
# virsh memtune r63 --hard-limit 1024004 --soft-limit 1024000 --swap-hard-limit 1024008

# virsh memtune --domain r63
hard_limit     : 1024004
soft_limit     : 1024000
swap_hard_limit: 1024008

# virsh memtune r63 --hard-limit 1024000 --swap-hard-limit 1024004

# virsh memtune --domain r63
hard_limit     : 1024000
soft_limit     : 1024000
swap_hard_limit: 1024004

also working fine.

3.when hard_limit is less than swap_hard_limit:
# virsh memtune r63 --hard-limit 1024008 --swap-hard-limit 1024004
error: Unable to change memory parameters
error: invalid argument: memory hard_limit tunable value must be lower than swap_hard_limit

So setting VERIFIED.

Comment 4 Ludek Smid 2014-06-13 09:44:31 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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