All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Paul Turner <pjt@google.com>
Subject: Re: [PATCH] sched: Check nr_running before calling pick_next_task in schedule().
Date: Sat, 02 Jul 2011 11:51:00 +0200	[thread overview]
Message-ID: <1309600260.10073.3.camel@twins> (raw)
In-Reply-To: <1309545711.4303.2.camel@localhost.localdomain>

On Sat, 2011-07-02 at 00:41 +0600, Rakib Mullick wrote:
> Currently at schedule(), when we call pick_next_task we don't check
> whether current rq is empty or not. Since idle_balance can fail,
> its nice to check whether we really have any task on rq or not. If
> not, we can call idle_sched_class.pick_next_task straight.
> 
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> ---
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 5925275..a4f4f58 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -4273,7 +4273,14 @@ need_resched:
>  		idle_balance(cpu, rq);
>  
>  	put_prev_task(rq, prev);
> -	next = pick_next_task(rq);
> +	/*  Since idle_balance can fail, its better to check rq->nr_running.
> +	 *  Otherwise we can call idle_sched_class.pick_next_task straight,
> +	 *  cause we need to do some accounting.
> +	 */
> +	if (likely(rq->nr_running))
> +		next = pick_next_task(rq);
> +	else
> +		next = idle_sched_class.pick_next_task(rq);
>  	clear_tsk_need_resched(prev);
>  	rq->skip_clock_update = 0;

Why!?

You're making the fast path -- picking a task -- slower by adding a
branch, and making the slow path -- going into idle -- faster. That
seems backwards at best.

You've completely failed to provide any sort of rationale for the patch
nor did you provide a use-case with performance numbers. This just isn't
making much sense at all.

  parent reply	other threads:[~2011-07-02  9:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01 18:41 [PATCH] sched: Check nr_running before calling pick_next_task in schedule() Rakib Mullick
2011-07-02  2:18 ` Paul Turner
2011-07-02  2:23 ` Paul Turner
2011-07-02  4:37   ` Rakib Mullick
2011-07-02  9:51 ` Peter Zijlstra [this message]
2011-07-02 14:26   ` Rakib Mullick
2011-07-02 15:35     ` Peter Zijlstra
2011-07-03  8:07       ` Rakib Mullick
2011-07-04  9:00         ` Rakib Mullick
2011-07-09  4:43     ` Rakib Mullick

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=1309600260.10073.3.camel@twins \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pjt@google.com \
    --cc=rakib.mullick@gmail.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 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.