All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ting Yang <tingy@cs.umass.edu>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [patch] CFS scheduler, -v7
Date: Thu, 03 May 2007 12:00:52 -0400	[thread overview]
Message-ID: <463A0734.6090408@cs.umass.edu> (raw)
In-Reply-To: <20070503151741.GC1812@elte.hu>

Hi, Ingo

    I wrote that email in a hurry, therefore might not explain the 
problem clearly. However I do think there is a problem for this part, 
after I carefully read the code again. Now I want to try again :-) 
Hopefully, this time I will do a right job.

Starting from the following code:

+    if (__delta > niced_granularity(rq, curr, granularity))
+        resched_task(curr);


Suppose, "curr" has nice value -10, then curr->load_shift = 15.  
Granularity passed into this function is
fixed 2,000,000 (for CFS -v8). Let's just divide everything by 1,000,000 
for simplicity, say granularity used is 2.

Now, we look at how granularity is rescaled:

+    int load_shift = p->load_shift;
+
+    if (load_shift == SCHED_LOAD_SHIFT)
+        return value;
+
+    return (value << load_shift) >> SCHED_LOAD_SHIFT;

it returns (2  << 15) >> 10 = 2 * 32 = 64, therefore __delta has to be 
larger than 64 so that the current process can be preempted.

Suppose, "curr" executes for 1 tick, an timer interrupts comes. It 
executes about 1,000,000 (roughly speaking, since timer interrupts come 
1000/second). Since we divided everything by 1,000,000, it becomes 1 in 
this discussion. After this execution, how much will "curr" increments 
its fair_key?
It is weighted: 1/32.

then how much time is needed for "curr" to build a 2 * 32 difference on 
fair_key, with every 1 ms it updates fair_key by 1/32 ?    2 * 32 * 32 !
On the other hand, for a task  has nice value 1, the amount work needed 
to preemption is 2 * 1 *1.
If we have only 2 task running, p1 with nice value -10, p2 with nice 
value 0.
           p1 get cup share:  (32 * 32) / (32 * 32 + 1 *1)
           p2 get cpu share:  ( 1* 1) / (32 * 32 + 1 * 1)

I do see a quadratic effect here. Did I missed anything? sorry to bother 
you again, I just want to help :-)

Thanks a lot !

Ting





  reply	other threads:[~2007-05-03 16:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30  5:20 [patch] CFS scheduler, -v7 Al Boldi
2007-05-03  7:45 ` Ingo Molnar
2007-05-03  8:07   ` Ingo Molnar
2007-05-03 11:16     ` Al Boldi
2007-05-03 12:36       ` Ingo Molnar
2007-05-03 13:49         ` Al Boldi
2007-05-03  8:42   ` Al Boldi
2007-05-03 15:02   ` Ting Yang
2007-05-03 15:17     ` Ingo Molnar
2007-05-03 16:00       ` Ting Yang [this message]
2007-05-03 19:48         ` Ingo Molnar
2007-05-03 19:57           ` William Lee Irwin III
  -- strict thread matches above, loose matches on Subject: below --
2007-04-28 15:25 Ingo Molnar
2007-04-28 19:20 ` S.Çağlar Onur
2007-04-28 19:24   ` Ingo Molnar
2007-04-28 23:42     ` S.Çağlar Onur
2007-04-29  7:11       ` Ingo Molnar
2007-04-29 12:37         ` S.Çağlar Onur
2007-04-29 15:58           ` Ingo Molnar
2007-04-29 22:29             ` Dennis Brendel
2007-04-30 14:38             ` S.Çağlar Onur
2007-04-28 19:27   ` S.Çağlar Onur
2007-04-29 17:28 ` Prakash Punnoor
2007-05-04 13:05   ` Prakash Punnoor
2007-04-30 16:29 ` Srivatsa Vaddagiri
2007-04-30 18:30 ` Balbir Singh

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=463A0734.6090408@cs.umass.edu \
    --to=tingy@cs.umass.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.