public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Bug in SCHED_IDLE interaction with group scheduling?
@ 2009-07-11  0:05 Paul Turner
  2009-07-11  8:01 ` Ingo Molnar
  2009-07-11  8:21 ` [tip:sched/urgent] sched: Fix bug in SCHED_IDLE interaction with group scheduling tip-bot for Paul Turner
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Turner @ 2009-07-11  0:05 UTC (permalink / raw)
  To: peterz, linux-kernel

Hi Peter,

It seems like there's an assumption in the sched_idle policy check in 
place_entity that the sched_entity we are looking at belongs to a task?

- Paul

--

sched: bug in SCHED_IDLE interaction with group scheduling

One of the isolation modifications for SCHED_IDLE is the unitization of sleeper
credit.  However the check for this assumes that the sched_entity we're placing
always belongs to a task.

This is potentially not true with group scheduling and leaves us rummaging
randomly when we try to pull the policy.

Signed-off-by: Paul Turner <pjt@google.com>
---
 kernel/sched_fair.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index ba7fd6e..7c248dc 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -687,7 +687,8 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 			 * all of which have the same weight.
 			 */
 			if (sched_feat(NORMALIZED_SLEEPER) &&
-					task_of(se)->policy != SCHED_IDLE)
+					(!entity_is_task(se) ||
+					 task_of(se)->policy != SCHED_IDLE))
 				thresh = calc_delta_fair(thresh, se);
 
 			vruntime -= thresh;
-- 
1.5.4.3


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

* Re: Bug in SCHED_IDLE interaction with group scheduling?
  2009-07-11  0:05 Bug in SCHED_IDLE interaction with group scheduling? Paul Turner
@ 2009-07-11  8:01 ` Ingo Molnar
  2009-07-11  8:21 ` [tip:sched/urgent] sched: Fix bug in SCHED_IDLE interaction with group scheduling tip-bot for Paul Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2009-07-11  8:01 UTC (permalink / raw)
  To: Paul Turner; +Cc: peterz, linux-kernel


* Paul Turner <pjt@google.com> wrote:

> Hi Peter,
> 
> It seems like there's an assumption in the sched_idle policy check in 
> place_entity that the sched_entity we are looking at belongs to a task?
> 
> - Paul
> 
> --
> 
> sched: bug in SCHED_IDLE interaction with group scheduling
> 
> One of the isolation modifications for SCHED_IDLE is the 
> unitization of sleeper credit.  However the check for this assumes 
> that the sched_entity we're placing always belongs to a task.
> 
> This is potentially not true with group scheduling and leaves us 
> rummaging randomly when we try to pull the policy.
> 
> Signed-off-by: Paul Turner <pjt@google.com>
> ---
>  kernel/sched_fair.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index ba7fd6e..7c248dc 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -687,7 +687,8 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
>  			 * all of which have the same weight.
>  			 */
>  			if (sched_feat(NORMALIZED_SLEEPER) &&
> -					task_of(se)->policy != SCHED_IDLE)
> +					(!entity_is_task(se) ||
> +					 task_of(se)->policy != SCHED_IDLE))
>  				thresh = calc_delta_fair(thresh, se);

Ah, nice catch!

( Sidenote: we keep having these subtle bugs where we call 
  task_of(se) on a non-task entity - it's been the fifth such 
  incident or so. Perhaps we should add an active debug check to 
  task_of(), in the case of CONFIG_SCHED_DEBUG=y. )

	Ingo

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

* [tip:sched/urgent] sched: Fix bug in SCHED_IDLE interaction with group scheduling
  2009-07-11  0:05 Bug in SCHED_IDLE interaction with group scheduling? Paul Turner
  2009-07-11  8:01 ` Ingo Molnar
@ 2009-07-11  8:21 ` tip-bot for Paul Turner
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Paul Turner @ 2009-07-11  8:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, pjt, tglx, mingo

Commit-ID:  d07387b490b1c43bfcb9f3900faf96f2dafb2630
Gitweb:     http://git.kernel.org/tip/d07387b490b1c43bfcb9f3900faf96f2dafb2630
Author:     Paul Turner <pjt@google.com>
AuthorDate: Fri, 10 Jul 2009 17:05:16 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 11 Jul 2009 10:00:09 +0200

sched: Fix bug in SCHED_IDLE interaction with group scheduling

One of the isolation modifications for SCHED_IDLE is the
unitization of sleeper credit.  However the check for this
assumes that the sched_entity we're placing always belongs to a
task.

This is potentially not true with group scheduling and leaves
us rummaging randomly when we try to pull the policy.

Signed-off-by: Paul Turner <pjt@google.com>
Cc: peterz@infradead.org
LKML-Reference: <alpine.DEB.1.00.0907101649570.29914@kitami.corp.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/sched_fair.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index ba7fd6e..7c248dc 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -687,7 +687,8 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 			 * all of which have the same weight.
 			 */
 			if (sched_feat(NORMALIZED_SLEEPER) &&
-					task_of(se)->policy != SCHED_IDLE)
+					(!entity_is_task(se) ||
+					 task_of(se)->policy != SCHED_IDLE))
 				thresh = calc_delta_fair(thresh, se);
 
 			vruntime -= thresh;

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

end of thread, other threads:[~2009-07-11  8:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-11  0:05 Bug in SCHED_IDLE interaction with group scheduling? Paul Turner
2009-07-11  8:01 ` Ingo Molnar
2009-07-11  8:21 ` [tip:sched/urgent] sched: Fix bug in SCHED_IDLE interaction with group scheduling tip-bot for Paul Turner

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