From owner-svn-src-all@freebsd.org Thu Nov 30 03:02:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1403DDF3E43; Thu, 30 Nov 2017 03:02:47 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B840C71002; Thu, 30 Nov 2017 03:02:46 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id KF7Ver3DVRDG7KF7WeZf1L; Wed, 29 Nov 2017 20:02:40 -0700 X-Authority-Analysis: v=2.2 cv=b+PC2pOx c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=sC3jslCIGhcA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=GeZk732AS-P6FUiDfOsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B1432413; Wed, 29 Nov 2017 19:02:36 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id vAU32aGw002438; Wed, 29 Nov 2017 19:02:36 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id vAU1tJfe070900; Wed, 29 Nov 2017 17:56:55 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201711300156.vAU1tJfe070900@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Hans Petter Selasky cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326376 - head/sys/kern In-Reply-To: Message from Hans Petter Selasky of "Wed, 29 Nov 2017 23:28:40 +0000." <201711292328.vATNSeOM046518@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 29 Nov 2017 17:55:19 -0800 X-CMAE-Envelope: MS4wfOOsIBcqqwXMVhMly9c7pdXzu7GOl8YR37egqm9S5luI/Qj/ohkx3PYlJJtAGuPQlFXk/33v6d6r12dCPpjKERBOWXGtgbs5mFTf1gC3t9i0LFwtGPUe PRk5QuZ80/yYQOB9o6z/WZpIMiGsuNUuJhfPkGpYYVc1hRswLhVBSdDTO78g+A6fF2u9bjhsg9Q8+esfowD2exvxqVAMxHWEtTHt3WX2gaX2lyjwfayPbrKZ EEZUKl35Nw1ST/Ha1oSNPJa4UpRgBo5kMyRWPJZwsvmKkPEUxhIlWCgW2PR3RsNR X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 03:02:47 -0000 In message <201711292328.vATNSeOM046518@repo.freebsd.org>, Hans Petter Selasky writes: > Author: hselasky > Date: Wed Nov 29 23:28:40 2017 > New Revision: 326376 > URL: https://svnweb.freebsd.org/changeset/base/326376 > > Log: > The sched_add() function is not only used when the thread is initially > started, but also by the turnstiles to mark a thread as runnable for > all locks, for instance sleepqueues do: > setrunnable()->sched_wakeup()->sched_add() > > In r326218 code was added to allow booting from non-zero CPU numbers > by setting the ts_cpu field inside the ULE scheduler's sched_add() > function. This had an undesired side-effect that prior sched_pin() and > sched_bind() calls got disregarded. This patch fixes the > initialization of the ts_cpu field for the ULE scheduler to only > happen once when the initial thread is constructed during system > init. Forking will then later on ensure that a valid ts_cpu value gets > copied to all children. > > Reviewed by: jhb, kib > Discussed with: nwhitehorn > MFC after: 1 month > Differential revision: https://reviews.freebsd.org/D13298 > Sponsored by: Mellanox Technologies > > Modified: > head/sys/kern/sched_ule.c > > Modified: head/sys/kern/sched_ule.c > ============================================================================= > = > --- head/sys/kern/sched_ule.c Wed Nov 29 21:16:14 2017 (r326375) > +++ head/sys/kern/sched_ule.c Wed Nov 29 23:28:40 2017 (r326376) > @@ -1405,7 +1405,6 @@ sched_setup(void *dummy) > > /* Add thread0's load since it's running. */ > TDQ_LOCK(tdq); > - td_get_sched(&thread0)->ts_cpu = curcpu; /* Something valid to start */ > thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF()); > tdq_load_add(tdq, &thread0); > tdq->tdq_lowpri = thread0.td_priority; > @@ -1642,6 +1641,7 @@ schedinit(void) > ts0->ts_ltick = ticks; > ts0->ts_ftick = ticks; > ts0->ts_slice = 0; > + ts0->ts_cpu = curcpu; /* set valid CPU number */ > } > > /* > @@ -2453,7 +2453,6 @@ sched_add(struct thread *td, int flags) > * Pick the destination cpu and if it isn't ours transfer to the > * target cpu. > */ > - td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to start */ > cpu = sched_pickcpu(td, flags); > tdq = sched_setcpu(td, cpu, flags); > tdq_add(tdq, td, flags); > Thank you. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.