From owner-freebsd-current@FreeBSD.ORG Wed Nov 3 18:16:03 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 90EA5106564A; Wed, 3 Nov 2010 18:16:03 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from out-0.mx.aerioconnect.net (outk.internet-mail-service.net [216.240.47.234]) by mx1.freebsd.org (Postfix) with ESMTP id 6D30C8FC0C; Wed, 3 Nov 2010 18:16:03 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id oA3HqHWI016933; Wed, 3 Nov 2010 10:52:18 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id D48AC2D6018; Wed, 3 Nov 2010 10:52:16 -0700 (PDT) Message-ID: <4CD1A14E.8060508@freebsd.org> Date: Wed, 03 Nov 2010 10:52:14 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: John Baldwin References: <4CD190EF.5080600@icyb.net.ua> <201011031317.36332.jhb@freebsd.org> In-Reply-To: <201011031317.36332.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: mdf@freebsd.org, freebsd-current@freebsd.org, Andriy Gapon Subject: Re: MTX_DEF versus MTX_SPIN 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, 03 Nov 2010 18:16:03 -0000 On 11/3/10 10:17 AM, John Baldwin wrote: > On Wednesday, November 03, 2010 1:04:13 pm mdf@freebsd.org wrote: >> >> So a MTX_DEF is okay in that environment? > Yes. In fact, the reason to have threads for interrupt handlers is to allow > interrupt handlers to use non-spin locks that block when the lock is held. > > MTX_SPIN locks are generally not needed in device drivers. The only reason a > driver would use one is if it used a filter handler which does not run in a > threaded context. It should be noted that in the case where you really just want to spin a few instructions because some other thread is accessing a structure you want, descheduling you. so you don't always incur the scheduling overhead.