mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH] sched: Skip looking at skip if next or last is set
Date: Wed, 20 Feb 2013 09:46:25 +0100	[thread overview]
Message-ID: <1361349985.10155.1.camel@laptop> (raw)
In-Reply-To: <20130218130146.GA7472@linux.vnet.ibm.com>

On Mon, 2013-02-18 at 18:31 +0530, Srikar Dronamraju wrote:
> pick_next_entity() prefers next, then last. However code checks if the
> left entity can be skipped even if next / last is set.
> 
> Check if left entity should be skipped only if next/last is not set.

You fail to explain why its a problem and continue to make a horrid mess
of the code..

> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> ---
>  kernel/sched/fair.c |   31 +++++++++++++++----------------
>  1 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index fdee793..cc97b12 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1900,27 +1900,26 @@ static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
>  	struct sched_entity *left = se;
>  
>  	/*
> -	 * Avoid running the skip buddy, if running something else can
> -	 * be done without getting too unfair.
> +	 * Someone really wants next to run. If it's not unfair, run it.
>  	 */
> -	if (cfs_rq->skip == se) {
> -		struct sched_entity *second = __pick_next_entity(se);
> +	if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
> +		se = cfs_rq->next;
> +	} else if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, left) < 1) {
> +		/*
> +		 * Prefer last buddy, try to return the CPU to a preempted
> +		 * task.
> +		 */
> +		se = cfs_rq->last;
> +	} else if (cfs_rq->skip == left) {
> +		/*
> +		 * Avoid running the skip buddy, if running something else
> +		 * can be done without getting too unfair.
> +		 */
> +		struct sched_entity *second = __pick_next_entity(left);
>  		if (second && wakeup_preempt_entity(second, left) < 1)
>  			se = second;
>  	}
>  
> -	/*
> -	 * Prefer last buddy, try to return the CPU to a preempted task.
> -	 */
> -	if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, left) < 1)
> -		se = cfs_rq->last;
> -
> -	/*
> -	 * Someone really wants this to run. If it's not unfair, run it.
> -	 */
> -	if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1)
> -		se = cfs_rq->next;
> -
>  	clear_buddies(cfs_rq, se);
>  
>  	return se;
> 



  reply	other threads:[~2013-02-20  8:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 13:01 Srikar Dronamraju
2013-02-20  8:46 ` Peter Zijlstra [this message]
2013-02-21 16:06   ` Srikar Dronamraju
2013-02-22  3:06     ` Michael Wang

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=1361349985.10155.1.camel@laptop \
    --to=peterz@infradead.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=srikar@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

Powered by JetHome