public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: KUROSAWA Takahiro <kurosawa@valinux.co.jp>
Cc: linux-kernel@vger.kernel.org, ckrm-tech@lists.sourceforge.net,
	Balbir Singh <balbir.singh@in.ibm.com>
Subject: Re: [ckrm-tech] [PATCH 1/2] add a CPU resource controller
Date: Mon, 13 Feb 2006 20:03:45 +0530	[thread overview]
Message-ID: <20060213143345.GA12279@in.ibm.com> (raw)
In-Reply-To: <20060209061147.2164.4528.sendpatchset@debian>

On Thu, Feb 09, 2006 at 03:11:47PM +0900, KUROSAWA Takahiro wrote:
> This patch adds CPU resource controller.  It enables us to control
> CPU time percentage of tasks grouped by the cpu_rc structure.
> It controls time_slice of tasks based on the feedback of difference
> between the target value and the current usage in order to control
> the percentage of the CPU usage to the target value.

I noticed some anomalies in guarantees that were provided to different classes.
Basically I had created two classes CA (10% guarantee) and CB (90% guarantee) 
and run few tasks on a 4-cpu system as below:

Case 1:

	CPU0	CPU1	CPU2	CPU3
	============================

	TA1	TA2	TA3	TA4
	TB1	TB2	TB3	TB4

Case 2:
	
	CPU0	CPU1	CPU2	CPU3
	============================

	TA1	TA2	TA3	TA4
	               		TB4

TA* tasks belong to CA and TB* belong to CB. All are CPU hungry tasks. Also 
each task is bound to the respective CPU indicated.

In both above cases, I found that CPU time was *equally* shared between the two 
classes (whereas I expected them to be shared in 1:9 ratio).

> +void cpu_rc_collect_hunger(task_t *tsk)
> +{

[snip]

> +	if (CPU_RC_GUAR_SCALE * tsk->last_slice	/ (wait + tsk->last_slice)
> +			< cr->guarantee / cr->rcd->numcpus)
					^^^^^^^^^^^^^^^^^^
					
Debugging it a bit indicated that the division of cr->guarantee by 
cr->rcd->numcpus in cpu_rc_collect_hunger doesn't seem to be required (since 
LHS is not on global scale and also the class's tasks may not be running
on other CPUs as in case 2). Removing the division rectified CPU sharing 
anomaly I had found.

Let me know what you think of this fix!


--- kernel/cpu_rc.c.org	2006-02-11 08:44:38.000000000 +0530
+++ kernel/cpu_rc.c	2006-02-13 18:34:30.000000000 +0530
@@ -204,7 +204,7 @@ void cpu_rc_collect_hunger(task_t *tsk)
 
 	wait = jiffies - tsk->last_activated;
 	if (CPU_RC_GUAR_SCALE * tsk->last_slice	/ (wait + tsk->last_slice)
-			< cr->guarantee / cr->rcd->numcpus)
+			< cr->guarantee)
 		cr->stat[cpu].maybe_hungry++;
 
 	tsk->last_activated = 0;



-- 
Regards,
vatsa

  reply	other threads:[~2006-02-13 14:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-09  6:11 [PATCH 0/2] CKRM CPU resource controller KUROSAWA Takahiro
2006-02-09  6:11 ` [PATCH 1/2] add a " KUROSAWA Takahiro
2006-02-13 14:33   ` Srivatsa Vaddagiri [this message]
2006-02-13 23:55     ` [ckrm-tech] " KUROSAWA Takahiro
2006-02-14  1:45       ` Srivatsa Vaddagiri
2006-02-09  6:11 ` [PATCH 2/2] connect the CPU resource controller to CKRM KUROSAWA Takahiro
2006-02-13 14:39   ` [ckrm-tech] " Srivatsa Vaddagiri
2006-02-13 23:22     ` KUROSAWA Takahiro
     [not found] <88299102B8C1F54BB5C8E47F30B2FBE201E95CD2@inblr-exch1.eu.uis.unisys.com>
2006-02-14  5:26 ` [ckrm-tech] [PATCH 1/2] add a CPU resource controller KUROSAWA Takahiro
2006-02-14  5:38   ` Srivatsa Vaddagiri
2006-02-14  5:58     ` KUROSAWA Takahiro
2006-02-14  5:27 ` Srivatsa Vaddagiri
     [not found] <88299102B8C1F54BB5C8E47F30B2FBE201E95DB0@inblr-exch1.eu.uis.unisys.com>
2006-02-14  5:57 ` KUROSAWA Takahiro
     [not found] <88299102B8C1F54BB5C8E47F30B2FBE201E95E78@inblr-exch1.eu.uis.unisys.com>
2006-02-14  6:44 ` KUROSAWA Takahiro
  -- strict thread matches above, loose matches on Subject: below --
2006-02-15  4:47 Suryanarayanan, Rajaram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060213143345.GA12279@in.ibm.com \
    --to=vatsa@in.ibm.com \
    --cc=balbir.singh@in.ibm.com \
    --cc=ckrm-tech@lists.sourceforge.net \
    --cc=kurosawa@valinux.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox