public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: bharata@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch] sched: call resched_task() conditionally from new task wake up path.
Date: Thu, 28 Aug 2008 11:25:07 +0200	[thread overview]
Message-ID: <1219915507.6443.13.camel@twins> (raw)
In-Reply-To: <20080828091249.GA3303@in.ibm.com>

On Thu, 2008-08-28 at 14:42 +0530, Bharata B Rao wrote:
> Hi,
> 
> sched: call resched_task() conditionally from new task wake up path.
> 
> - During wake up of a new task, task_new_fair() can do a resched_task()
>   on the current task. Later in the code path, check_preempt_curr() also ends
>   up doing the same, which can be avoided. Check if TIF_NEED_RESCHED is
>   already set for the current task.
> 
> - task_new_fair() does a resched_task() on the current task unconditionally.
>   This can be done only in case when child runs before the parent.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> CC: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

> CC: Ingo Molnar <mingo@elte.hu>
> ---
>  kernel/sched_fair.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -1348,6 +1348,13 @@ static void check_preempt_wakeup(struct 
>  	if (unlikely(se == pse))
>  		return;
>  
> +	/*
> +	 * We can come here with TIF_NEED_RESCHED already set from new task
> +	 * wake up path.
> +	 */
> +	if (test_tsk_need_resched(curr))
> +		return;
> +
>  	cfs_rq_of(pse)->next = pse;
>  
>  	/*
> @@ -1615,10 +1622,10 @@ static void task_new_fair(struct rq *rq,
>  		 * 'current' within the tree based on its new key value.
>  		 */
>  		swap(curr->vruntime, se->vruntime);
> +		resched_task(rq->curr);
>  	}
>  
>  	enqueue_task_fair(rq, p, 0);
> -	resched_task(rq->curr);
>  }
>  
>  /*
> 
> Regards,
> Bharata.


  reply	other threads:[~2008-08-28  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28  9:12 [patch] sched: call resched_task() conditionally from new task wake up path Bharata B Rao
2008-08-28  9:25 ` Peter Zijlstra [this message]
2008-08-28  9:25 ` Ingo Molnar

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=1219915507.6443.13.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vatsa@linux.vnet.ibm.com \
    /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