Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 727458

Summary: cpu.share doesn't limit the cpu usage
Product: Red Hat Enterprise Linux 6 Reporter: Suqin Huang <shuang>
Component: kernelAssignee: Jacob Tanenbaum <jtanenba>
Status: CLOSED NOTABUG QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: dhoward, qcai, shuang, sluo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 918395 (view as bug list) Environment:
Last Closed: 2014-03-19 18:00:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 918395    

Description Suqin Huang 2011-08-02 08:13:13 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. create cgroups
# mount -t cgroup -o cpu none /cgroup
# mkdir /cgroup/cpu1
# mkdir /cgroup/cpu2

2. set cpu.share for each cgroup
# ech0 1024 > /cgroup/cpu1/cpu.share
# echo 2048 > /cgroup/cpu2/cpu.share

3. boot two guests (both with 2 vcpu)

4. echo pidof-guest1 to > /cgroup/cpu1/tasks (contain threads)
5. echo pidof-guest2 to > /cgroup/cpu2/tasks (contain threads)
6. run the following script in guests:

#include <stdio.h>

int main(void){
        int i;

        for(;;){
                i += 1;
        }

        return 0;
}

  
guest1: run 3 tasks with above script
guest2: run 1 tasks with above script

Actual results:
cpu usage: guest1 vs. guest2 : 300% vs. 100%

Expected results:
cpu usage: guest1 vs. guest2 : 50% vs. 100%

Additional info:

Comment 4 Sibiao Luo 2013-03-06 07:23:51 UTC
Hi all,

   I tried the kernel-2.6.32-356.el6.x86_64, but still hit this issue, the cpu.shares fail to limit the cpu usage correctly. btw, i also hit it in rhel7 host, i will clone it to rhel7.

host info:
kernel-2.6.32-356.el6.x86_64
qemu-kvm-0.12.1.2-2.358.el6.x86_64

guest info:
kernel-2.6.32-356.el6.x86_64

Steps:
the same to comment #0.
# echo 1024 > /cgroup/cpu1/cpu.shares 
# echo 2048 > /cgroup/cpu2/cpu.shares 
both two guests with 2 vcpu.

Results:
The cpu usage: guest1 vs. guest2 : 200% vs. 100%
# top
...
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                        
13865 root      20   0 2586m 602m 4540 S 199.4  7.7   4:06.69 qemu-kvm <--guest1                                                                                                      
13888 root      20   0 2559m 603m 4540 S 99.4   7.7   3:09.15 qemu-kvm <--guest2


If run 2 tasks with above script in each guest, the cpu usage: guest1 vs. guest2 : 200% vs. 200%
# top
  PID USER     PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                        
13865 root     20   0 2586m 602m 4540 S 199.7  7.7   1:57.07 qemu-kvm  <--guest1                                                                                                     
13888 root     20   0 2559m 602m 4540 S 199.7  7.7   1:41.49 qemu-kvm  <--guest2

Best Regards.
sluo

Comment 7 RHEL Program Management 2013-10-14 05:15:35 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 9 Jacob Tanenbaum 2014-03-19 18:00:00 UTC
It appears that in the absence of additional information cpu.share is acting as it should. Additionally the customer bug attached has been closed

Comment 10 Red Hat Bugzilla 2023-09-14 01:24:41 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days