From owner-freebsd-drivers@FreeBSD.ORG Thu May 30 12:18:52 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C83CA7A9 for ; Thu, 30 May 2013 12:18:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 80247A7C for ; Thu, 30 May 2013 12:18:52 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A68E5B963; Thu, 30 May 2013 08:18:51 -0400 (EDT) From: John Baldwin To: Orit Moskovich Subject: Re: taskqueues Date: Thu, 30 May 2013 08:06:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> <201305291156.29230.jhb@freebsd.org> <981733489AB3BD4DB24B48340F53E0A55B0D63D3@MTLDAG01.mtl.com> In-Reply-To: <981733489AB3BD4DB24B48340F53E0A55B0D63D3@MTLDAG01.mtl.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201305300806.24399.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 30 May 2013 08:18:51 -0400 (EDT) Cc: "freebsd-drivers@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 12:18:52 -0000 On Thursday, May 30, 2013 1:12:31 am Orit Moskovich wrote: > From the SMPng Design Document, I read that interrupt threads run at real-time kernel priority. The priority ranges have changed since I wrote that (and what I wrote wasn't really accurate). There isn't really a real-time kernel priority range. The ithread priorities are the most important, followed by user real-time priorities, in-kernel sleep priorities, user time-sharing priorities, and finally user idle priorities. > So wouldn't it be better to define a taskqueue using TASKQUEUE_FAST_DEFINE, but instead of ' taskqueue_start_threads(&taskqueue_foo, 1, PI_NET, "foo taskq"); ', use > swi_add(NULL, "...", taskqueue_swi_run, NULL, PI_NET, > INTR_MPSAFE, &taskqueue_ih)) Well, swi_add() doesn't take a direct priority, it takes a SWI_xxx constant that it passes to PI_SWI to generate a priority (so you'd need a gross hack of using a negative number to get a resulting priority of PI_NET). However, the threads created (whether by swi_add() or taskqueue_start_threads()) would be treated exactly the same by the scheduler. There is nothing special about ithreads except that they are assigned to a dedicated priority range by default. Any other thread can use those priorities (and they do for during priority lending), but most other threads in the kernel do not use ithread priorities by convention unless they are doing ithread-type work. -- John Baldwin