From owner-svn-src-head@freebsd.org Fri Feb 23 23:21:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5268AF297A9; Fri, 23 Feb 2018 23:21:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA7CD7EBF8; Fri, 23 Feb 2018 23:21:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w1NNL3iB005142 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 24 Feb 2018 01:21:07 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w1NNL3iB005142 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w1NNL3e2005141; Sat, 24 Feb 2018 01:21:03 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 Feb 2018 01:21:03 +0200 From: Konstantin Belousov To: Don Lewis Cc: Rick Macklem , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r329875 - head/sys/kern Message-ID: <20180223232103.GK94212@kib.kiev.ua> References: <201802231826.w1NIQVqr084972@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 23:21:15 -0000 On Fri, Feb 23, 2018 at 02:59:11PM -0800, Don Lewis wrote: > On 23 Feb, Rick Macklem wrote: > > Konstantin Belousov wrote: > >>Author: kib > >>Date: Fri Feb 23 18:26:31 2018 > >>New Revision: 329875 > >>URL: https://svnweb.freebsd.org/changeset/base/329875 > >> > >>Log: > >> Restore UP build. > >> > >> Reviewed by: truckman > >> Sponsored by: The FreeBSD Foundation > >> > >>Modified: > >> head/sys/kern/sched_ule.c > >> > >>Modified: head/sys/kern/sched_ule.c > >>============================================================================== > >>--- head/sys/kern/sched_ule.c Fri Feb 23 18:18:42 2018 (r329874) > >>+++ head/sys/kern/sched_ule.c Fri Feb 23 18:26:31 2018 (r329875) > >>@@ -1864,6 +1864,7 @@ sched_lend_user_prio(struct thread *td, u_char prio) > >> td->td_flags |= TDF_NEEDRESCHED; > >> } > >> > >>+#ifdef SMP > >> /* > >> * This tdq is about to idle. Try to steal a thread from another CPU before > >> * choosing the idle thread. > >>@@ -1945,6 +1946,7 @@ tdq_trysteal(struct tdq *tdq) > >> } > >> spinlock_exit(); > > >} > >>+#endif > >> > >> /* > >> * Handle migration from sched_switch(). This happens only for > >>@@ -2058,8 +2060,10 @@ sched_switch(struct thread *td, struct thread *newtd, > >> TDQ_LOCK(tdq); > >> mtx = thread_lock_block(td); > >> tdq_load_rem(tdq, td); > >>+#ifdef SMP > >> if (tdq->tdq_load == 0) > > Since the function isn't called for UP, should this "if" also check for ncpus > 1 by any chance? > > (I know nothing about ULE, so please ignore this if it doesn't make sense;-) > >> tdq_trysteal(tdq); > >>+#endif > >> } > >> > >> #if (KTR_COMPILE & KTR_SCHED) != 0 > > That would probably be a microoptimization. I think one of the tests at > the top of tdq_trysteal() will cause an immediate return. Basically > you'd be eliminating an extraneous function call in the path to > switching to the idle thread after you have already determined that you > don't have any work to do. Yes, smp_started is zero on UP.