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 1106656 - Docker run --memory value doesn't match cgroup value
Summary: Docker run --memory value doesn't match cgroup value
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.0
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Matthew Heon
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1109938
TreeView+ depends on / blocked
 
Reported: 2014-06-09 17:00 UTC by Chris Evich
Modified: 2019-03-06 01:50 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-18 20:45:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1266 0 normal SHIPPED_LIVE docker bug fix and enhancement update 2014-09-19 00:45:12 UTC

Description Chris Evich 2014-06-09 17:00:46 UTC
Description of problem:
Some values to the --memory option result in an exact match to the cgroup value, others are slightly off.  If expected, then this could be fixed with a documentation update.

Version-Release number of selected component (if applicable):
docker-0.11.1-10.el7.x86_64

How reproducible:
very

Steps to Reproduce:

docker run -d -t -m 524889 some_image bash
...
cat /sys/fs/cgroup/memory/system.slice/.../memory.limit_in_bytes 
5246976

Same result for --memory 524889 value suffixes of:
b and B  => cgroup: 5246976
k and K  => cgroup: 5368721408

Suffixes for 'm' and 'g' seem to correctly represent specified value.

Actual results:
Values specified on command line sometimes don't match value in cgroup file

Expected results:
Values from command line should match value in cgroup file, a message should
be printed or logged if the value is altered, and/or value manipulation/conformity rules should be documented for the --memory option.

Comment 1 Guohua Ouyang 2014-06-10 01:56:53 UTC
I think I caught this, the memory size must be a multiper of 4096.

I tested below:
set memory limits    crgoup memory limits
=================    ========================
1024m                1073741824
1g                   1073741824
1048576k             1073741824
1073741824           1073741824
1048576              1048576
1024575              1048576
1048577              1052672 (1048576 + 4096)
1052673              1056768 (1052672 + 4096)
=================    ========================

so this should be not a bug.

Comment 2 Guohua Ouyang 2014-06-10 02:13:41 UTC
for the example in the bug, 524889 is between 524288 ~ 528384, so the value in cgroups should be the later.

#docker run -d -t -m 524889 some_image bash

# cat docker-dd95e808b318c29f3f79266118768d4cd196f3a9f2eea88bc8d473a71b58b27d.scope/memory.limit_in_bytes 
528384

>>>528384 - 524288 (1024*4*(524889 / 4096)
4096

Comment 3 Chris Evich 2014-06-10 14:59:48 UTC
Great, thanks for confirming.  Moving this to 'low' severity then since it'll just be a short documentation/man page update then.  I'd suggest something like:

The value may be rounded up to the next multiple of the host's memory page size(?) (typically 4k) unless an exact multiple is given.

Comment 4 Matthew Heon 2014-06-25 16:47:59 UTC
Patch sent to upstream for this (https://github.com/dotcloud/docker/pull/6680). Should appear in our builds of docker-1.0 for RHEL7 soon.

Comment 5 Daniel Walsh 2014-06-27 16:26:44 UTC
Fixed in docker-1.0

Comment 10 errata-xmlrpc 2014-09-18 20:45:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1266.html


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