[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160818112825.GB10153@twins.programming.kicks-ass.net>
Date: Thu, 18 Aug 2016 13:28:26 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Colin Vidal <colin@...dal.org>
Cc: linux-kernel@...r.kernel.org, mingo@...hat.com
Subject: Re: sched: current instead rq->current
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.
Powered by blists - more mailing lists