From owner-freebsd-current@FreeBSD.ORG Wed Sep 1 17:20:07 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA4AB10656A4 for ; Wed, 1 Sep 2010 17:20:07 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by mx1.freebsd.org (Postfix) with ESMTP id B063F8FC21 for ; Wed, 1 Sep 2010 17:20:07 +0000 (UTC) Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id CAFCF28F75A; Wed, 1 Sep 2010 12:04:52 -0500 (CDT) X-Virus-Scanned: by amavis-2.6.4 at mh2.mail.rice.edu, auth channel Received: from mh2.mail.rice.edu ([127.0.0.1]) by mh2.mail.rice.edu (mh2.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id tAcg4eP6NpNu; Wed, 1 Sep 2010 12:04:52 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id C8EDF28F757; Wed, 1 Sep 2010 12:04:51 -0500 (CDT) Message-ID: <4C7E87B3.50104@rice.edu> Date: Wed, 01 Sep 2010 12:04:51 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.24 (X11/20100725) MIME-Version: 1.0 To: mdf@FreeBSD.org References: <201009010950.00422.jhb@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 01 Sep 2010 17:24:48 +0000 Cc: freebsd-current@freebsd.org, Jeff Roberson Subject: Re: sched_pin() bug in SCHED_ULE X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 17:20:07 -0000 mdf@FreeBSD.org wrote: [snip] > I will test this patch out; thanks for the help! > > Two questions: > > 1) How does a thread get moved between CPUs when it's not running? I > see that we change the runqueue for non-running threads that are on a > runqueue. Does the code always check for THREAD_CAN_SCHED when adding > a sleeping thread to a runqueue on wakeup? > > 2) I assume sched_switch() runs a lot more often than sched_pin() or > sched_affinity(), so it would make sense to add any performance > penalty of increased work in either of those places than in the > scheduler. I suppose the two memory references for THREAD_CAN_MIGRATE > and THREAD_CAN_SCHED won't be that expensive. > sched_pin() gets used a fair amount on i386 for creating temporary mappings in order to avoid the need for system-wide TLB shootdowns. The use cases range from the fast path for pipes to page zeroing. Alan