From owner-svn-src-all@FreeBSD.ORG Wed Apr 29 16:54:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E056A106564A; Wed, 29 Apr 2009 16:54:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2308FC18; Wed, 29 Apr 2009 16:54:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LzD39-000OKN-0p; Wed, 29 Apr 2009 19:54:23 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n3TGsHkV063398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Apr 2009 19:54:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n3TGsHYO086267; Wed, 29 Apr 2009 19:54:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n3TGsHkX086266; Wed, 29 Apr 2009 19:54:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Apr 2009 19:54:17 +0300 From: Kostik Belousov To: Jeff Roberson Message-ID: <20090429165417.GG40751@deviant.kiev.zoral.com.ua> References: <200904290315.n3T3FiJW067558@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7fVr/IRGAG9sAW4J" Content-Disposition: inline In-Reply-To: <200904290315.n3T3FiJW067558@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LzD39-000OKN-0p 8121c4aa6e171d12d2c3816b10cfc230 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191643 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 29 Apr 2009 16:54:27 -0000 --7fVr/IRGAG9sAW4J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 29, 2009 at 03:15:44AM +0000, Jeff Roberson wrote: > Author: jeff > Date: Wed Apr 29 03:15:43 2009 > New Revision: 191643 > URL: http://svn.freebsd.org/changeset/base/191643 >=20 > Log: > - Remove the bogus idle thread state code. This may have a race in it > and it only optimized out an ipi or mwait in very few cases. > - Skip the adaptive idle code when running on SMT or HTT cores. This > just wastes cpu time that could be used on a busy thread on the same > core. > - Rename CG_FLAG_THREAD to CG_FLAG_SMT to be more descriptive. Re-use > CG_FLAG_THREAD to mean SMT or HTT. > =20 > Sponsored by: Nokia >=20 > Modified: > head/sys/kern/sched_ule.c > head/sys/kern/subr_smp.c > head/sys/sys/smp.h Now I see a reason why it is better #ifdef SMP the code that uses CG_FLAG_*. Also, we should check for tdq_cg !=3D NULL in one more place. See the patch below, instead of exposing CG_FLAG_* for !SMP configs. diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 680572d..fe3a119 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -891,6 +891,7 @@ tdq_move(struct tdq *from, struct tdq *to) return (1); } =20 +#ifdef SMP /* * This tdq has idled. Try to steal a thread from another cpu and switch * to it. @@ -947,6 +948,7 @@ tdq_idled(struct tdq *tdq) spinlock_exit(); return (1); } +#endif =20 /* * Notify a remote cpu of new work. Sends an IPI if criteria are met. @@ -2525,7 +2527,9 @@ sched_idletd(void *dummy) struct thread *td; struct tdq *tdq; int switchcnt; +#ifdef SMP int i; +#endif =20 mtx_assert(&Giant, MA_NOTOWNED); td =3D curthread; @@ -2543,7 +2547,9 @@ sched_idletd(void *dummy) * loops while on SMT machines as this simply steals * cycles from cores doing useful work. */ - if ((tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) =3D=3D 0 && +#ifdef SMP + if (tdq->tdq_cg !=3D NULL && + (tdq->tdq_cg->cg_flags & CG_FLAG_THREAD) =3D=3D 0 && switchcnt > sched_idlespinthresh) { for (i =3D 0; i < sched_idlespins; i++) { if (tdq->tdq_load) @@ -2551,6 +2557,7 @@ sched_idletd(void *dummy) cpu_spinwait(); } } +#endif switchcnt =3D tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; if (tdq->tdq_load =3D=3D 0) cpu_idle(switchcnt > 1); --7fVr/IRGAG9sAW4J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkn4hjgACgkQC3+MBN1Mb4hsoACfVDIzV4KqZR5Zi/scpiolmWf6 L/UAn0dGosIBRmlW16kn/07cNChsla6g =MG++ -----END PGP SIGNATURE----- --7fVr/IRGAG9sAW4J--