From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753898AbcHQTjr (ORCPT ); Wed, 17 Aug 2016 15:39:47 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:52267 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753023AbcHQTjq (ORCPT ); Wed, 17 Aug 2016 15:39:46 -0400 X-Sasl-enc: CFdQ+cnqchO6kpXSbDGSZK3Cdj6Gz19HQuEGmHKoTI0N 1471462783 Message-ID: <1471462781.2204.5.camel@cvidal.org> Subject: Re: sched: current instead rq->current From: Colin Vidal To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org Date: Wed, 17 Aug 2016 21:39:41 +0200 In-Reply-To: <1471289435.8946.28.camel@cvidal.org> References: <1471289435.8946.28.camel@cvidal.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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 I realize that I have forgotten to add scheduler subsystem in CC... So I do it now. Sorry for double post. Thanks Colin