All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Vidal <colin@cvidal.org>
To: linux-kernel@vger.kernel.org
Subject: sched: current instead rq->current
Date: Mon, 15 Aug 2016 21:30:35 +0200	[thread overview]
Message-ID: <1471289435.8946.28.camel@cvidal.org> (raw)

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?

Since a runqueue is specific to a CPU, it dosen't make sense to get the
the current task of another CPU's runqueue. Yes?

I try the following of Linus's master branch

-       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?

Thanks!

Colin

             reply	other threads:[~2016-08-15 19:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 19:30 Colin Vidal [this message]
2016-08-17 19:39 ` sched: current instead rq->current Colin Vidal
2016-08-18 11:28   ` Peter Zijlstra

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=1471289435.8946.28.camel@cvidal.org \
    --to=colin@cvidal.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.