All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Amit K. Arora" <aarora@linux.vnet.ibm.com>
To: Chris Friesen <cfriesen@nortel.com>
Cc: linux-kernel@vger.kernel.org, vatsa@linux.vnet.ibm.com,
	a.p.zijlstra@chello.nl, mingo@elte.hu
Subject: Re: [PATCH] sched: minor optimizations in wake_affine and select_task_rq_fair
Date: Tue, 30 Sep 2008 12:33:26 +0530	[thread overview]
Message-ID: <20080930070326.GA5331@amitarora.in.ibm.com> (raw)
In-Reply-To: <48E0FDC5.1080500@nortel.com>

On Mon, Sep 29, 2008 at 10:09:41AM -0600, Chris Friesen wrote:
> Amit K. Arora wrote:
>> sched: Minor optimizations in wake_affine and select_task_rq_fair
>>
>> This patch does following:
>> o Reduces the number of arguments to wake_affine().
>
> At what point is it cheaper to pass items as args rather than recalculating 
> them?  If reducing the number of args is desirable, what about removing the 
> "this_cpu" and "prev_cpu" args and recalculating them in wake_affine()?

Thats a good question. Its kind of arguable and I wasn't sure if
everyone will be happy if I removed more arguments from wake_affine() than
what I did in my patch (because of the recalculations required).

wake_affine() currently has 11 arguments and I thought it may make sense
in reducing it to a sane number. For that I chose arguments which I
thought can be recalculated with minimum overhead (involves single struct
dereference, a simple per cpu variable and/or a simple arithmetic). And
one argument ("rq") which is being removed, isn't used at all in the
function!

Regarding the two variables you have mentioned, I didn't remove them as
args since I wasn't sure of "this_cpu" (which is nothing but
smp_processor_id()) as it is arch dependent, and calculating "prev_cpu"
involves two struct dereferences (((struct thread_info *)(task)->stack)->cpu).
And the calculation for other arguments (like, this_sd, load and this_load)
involves good amount of instructions.

If you disagree, what do you suggest we do here ?

Regards,
Amit Arora

  parent reply	other threads:[~2008-09-30  7:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29 10:02 [PATCH] sched: minor optimizations in wake_affine and select_task_rq_fair Amit K. Arora
2008-09-29 16:09 ` Chris Friesen
2008-09-30  7:01   ` Ingo Molnar
2008-09-30 11:40     ` Amit K. Arora
2008-09-30  7:03   ` Amit K. Arora [this message]
2008-09-30 11:45 ` [PATCH][resubmit] " Amit K. Arora
2008-09-30 13:26   ` 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=20080930070326.GA5331@amitarora.in.ibm.com \
    --to=aarora@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=cfriesen@nortel.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 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.