From owner-freebsd-current@FreeBSD.ORG Tue Aug 30 05:29:05 2011 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 8A203106564A; Tue, 30 Aug 2011 05:29:05 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 4E3768FC08; Tue, 30 Aug 2011 05:29:05 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 17F0573027; Tue, 30 Aug 2011 07:44:12 +0200 (CEST) Date: Tue, 30 Aug 2011 07:44:12 +0200 From: Luigi Rizzo To: John Baldwin , freebsd-current@freebsd.org Message-ID: <20110830054412.GA43880@onelab2.iet.unipi.it> References: <20110826153940.GA3800@onelab2.iet.unipi.it> <201108261313.03441.jhb@freebsd.org> <20110826210101.GA5822@onelab2.iet.unipi.it> <20110830002315.GD3098@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110830002315.GD3098@funkthat.com> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: kqueue and device driver experience anyone ? 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: Tue, 30 Aug 2011 05:29:05 -0000 On Mon, Aug 29, 2011 at 05:23:15PM -0700, John-Mark Gurney wrote: > Luigi Rizzo wrote this message on Fri, Aug 26, 2011 at 23:01 +0200: > > The other thing i need (but i believe i know how to handle it) > > is tell whether .f_event() is called by KNOTE() or by kqueue_scan(), > > but i believe i can use the "hint" argument to tell the two. > > Why do you need to know the difference? kqueue is a level triggered because i want to control what gets executed in the lower and upper half of the kernel, for two reasons: - livelock/interrupt mitigation control. I want the bottom half to be as lightweight as possible so that the system does not get overwhelmed by incoming interrupts. - reduced locking overhead. If the bottom half only notifies that 'something happened', it does not need to bother locking device specific data structures. For things like netmap this is especially useful because some data structures are shared between kernel and userland and the only way to protect access is make sure that the kernel only plays with them when it is in the upper half. cheers luigi