public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* check_preempt_tick() check vruntime mistake?
@ 2009-12-11  4:17 XingChao Wang
  2009-12-11  7:25 ` Mike Galbraith
  0 siblings, 1 reply; 2+ messages in thread
From: XingChao Wang @ 2009-12-11  4:17 UTC (permalink / raw)
  To: kernel list; +Cc: mingo, Peter Zijlstra

Hi Ingo,peter,

When check_preempt_tick() selects next leftmost sched_entity,it
calculates delta vruntime of curr and leftmost entity, then compares
it with ideal_runtime. But ideal_runtime is real-time type, need
convert it to virtual-time ,right?

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 37087a7..9b903d4 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -840,7 +840,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct
sched_entity *curr)
                struct sched_entity *se = __pick_next_entity(cfs_rq);
                s64 delta = curr->vruntime - se->vruntime;

-               if (delta > ideal_runtime)
+               if (delta > calc_delta_fair(ideal_runtime, curr))
                        resched_task(rq_of(cfs_rq)->curr);
        }
 }

thanks
--wang xingchao

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: check_preempt_tick() check vruntime mistake?
  2009-12-11  4:17 check_preempt_tick() check vruntime mistake? XingChao Wang
@ 2009-12-11  7:25 ` Mike Galbraith
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Galbraith @ 2009-12-11  7:25 UTC (permalink / raw)
  To: XingChao Wang; +Cc: kernel list, mingo, Peter Zijlstra

On Fri, 2009-12-11 at 12:17 +0800, XingChao Wang wrote:
> Hi Ingo,peter,
> 
> When check_preempt_tick() selects next leftmost sched_entity,it
> calculates delta vruntime of curr and leftmost entity, then compares
> it with ideal_runtime. But ideal_runtime is real-time type, need
> convert it to virtual-time ,right?

Why?  The scheduler converges vruntimes to within min_granularity,
that's it's mission.  What this test is trying to say is that if the
awakened task's lag has grown to be more than your quantum while we
waited for the tick to come along, you need to get out of it's way so it
can catch up.

Now, there are a couple ~problems in that in it's current form, it
offers protection to SCHED_BATCH and SCHED_IDLE tasks, and the test..

if (delta_exec < sysctl_sched_min_granularity)
	return;

..is... not exactly optimal for light weight tasks, but the lighter you
get, the more likely you'd already have been preempted...

I have a patch which excludes these, and computes min runtime based on
differential in task weights.  These are the only things I see ~wrong.
ideal_runtime is weighted, and is our "fair unit of measure", so using
it to measure acceptable lag distance is correct AFAIKS.

> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index 37087a7..9b903d4 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -840,7 +840,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct
> sched_entity *curr)
>                 struct sched_entity *se = __pick_next_entity(cfs_rq);
>                 s64 delta = curr->vruntime - se->vruntime;
> 
> -               if (delta > ideal_runtime)
> +               if (delta > calc_delta_fair(ideal_runtime, curr))
>                         resched_task(rq_of(cfs_rq)->curr);
>         }
>  }
> 
> thanks
> --wang xingchao
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-11  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11  4:17 check_preempt_tick() check vruntime mistake? XingChao Wang
2009-12-11  7:25 ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox