From owner-freebsd-arch@freebsd.org Mon Oct 30 16:05:11 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2A53E6093C for ; Mon, 30 Oct 2017 16:05:11 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83755686A8 for ; Mon, 30 Oct 2017 16:05:11 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: f6e36dcf-bd8b-11e7-b50b-53dc5ecda239 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id f6e36dcf-bd8b-11e7-b50b-53dc5ecda239; Mon, 30 Oct 2017 16:04:10 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v9UG53Vx001351; Mon, 30 Oct 2017 10:05:04 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1509379503.21609.103.camel@freebsd.org> Subject: Re: Allow faster eventhandler dispatching by keeping pointers to handler lists. From: Ian Lepore To: Hans Petter Selasky , Matt Joras , "freebsd-arch@FreeBSD.org" Date: Mon, 30 Oct 2017 10:05:03 -0600 In-Reply-To: <0fad1391-726d-8215-075d-9411abdf6edb@selasky.org> References: <1509243567.56824.103.camel@freebsd.org> <3a71dd31-99cb-c891-9d52-a7f2e7010011@FreeBSD.org> <1509293552.21609.5.camel@freebsd.org> <1509294247.21609.12.camel@freebsd.org> <7b59ff3d-3458-0bca-e6b4-13454b13efb0@FreeBSD.org> <1509296624.21609.24.camel@freebsd.org> <0fad1391-726d-8215-075d-9411abdf6edb@selasky.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2017 16:05:11 -0000 On Mon, 2017-10-30 at 09:17 +0100, Hans Petter Selasky wrote: > On 10/29/17 18:03, Ian Lepore wrote: > > > > Oh.  Right.  Hmmm, I think malloc() is required to support the case > > where a handler registers before the static list init is invoked, and I > > do think that's a useful feature to preserve.  That means the lists > > aren't really static, though, which then makes STATIC a bit out of > > place in the new function/macro names. > Why not use RCU here, and then update sys/queue.h to be RCU safe? > > --HPS I'm not sure how that suggestion relates to that paragraph, but the code already does use a form of RCU to handle deletion of registered handlers from individual event lists.  It could probably benefit from a rewrite to more fully embrace RCU and use it for insertions as well, but that's beyond the scope of these changes, which are trying to eliminate the worst uses of a global lock at a higher level than maintaining the list for a single event. -- Ian