From: Peter Zijlstra <peterz@infradead.org>
To: Colin Vidal <colin@cvidal.org>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com
Subject: Re: sched: current instead rq->current
Date: Thu, 18 Aug 2016 13:28:26 +0200 [thread overview]
Message-ID: <20160818112825.GB10153@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1471462781.2204.5.camel@cvidal.org>
On Wed, Aug 17, 2016 at 09:39:41PM +0200, Colin Vidal wrote:
> On Mon, 2016-08-15 at 21:30 +0200, Colin Vidal wrote:
> > Hello,
> >
> > At the beginning of __schedule (kernel/sched/core.c), the current
> > task
> > is get with rq->curr. I try to to understand why not directly using
> > current instead?
> > - int cpu;
> >
> > - cpu = smp_processor_id();
> > - rq = cpu_rq(cpu);
> > - prev = rq->curr;
> > + rq = cpu_rq(smp_processor_id());
> > + prev = current;
> >
> > and it seems to work (only tested on x86-64), but... To simple?
its more expensive, rq->curr is a simple dereference (and we need that
cacheline anyway), while current is a weird macro that expands to
potentially a lot of code, depending on the arch.
prev parent reply other threads:[~2016-08-18 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 19:30 Colin Vidal
2016-08-17 19:39 ` Colin Vidal
2016-08-18 11:28 ` Peter Zijlstra [this message]
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=20160818112825.GB10153@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=colin@cvidal.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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