Date: Thu, 04 Jan 2001 09:08:47 -0800 From: Kirk McKusick <mckusick@mckusick.com> To: Alfred Perlstein <bright@wintelcom.net> Cc: Will Andrews <will@physics.purdue.edu>, Peter Wemm <peter@netplex.com.au>, Stephen McKay <mckay@thehub.com.au>, phk@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: Reinstatement of CIRCLEQ Message-ID: <200101041708.JAA05731@beastie.mckusick.com> In-Reply-To: Your message of "Thu, 04 Jan 2001 00:19:43 PST." <20010104001943.T292@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Date: Thu, 4 Jan 2001 00:19:43 -0800 From: Alfred Perlstein <bright@wintelcom.net> To: Kirk McKusick <mckusick@mckusick.com> Subject: Re: Reinstatement of CIRCLEQ In-Reply-To: <200101040719.XAA04872@beastie.mckusick.com>; from mckusick@mckusick.com on Wed, Jan 03, 2001 at 11:19:02PM -0800 You're right, I'm wondering though, would it be possible to change TAILQ_PREV(elm, headname, field) to TAILQ_PREV(elm, field) by using the offset of 'field' into the struct? You could subtract the offset of 'field' from the tqe_prev of the next struct right? This would also reduce it by one memory access. Or is this the unportability/headache you were trying to avoid? -Alfred You are correct that your suggested change is exactly the unportability/headache that I am trying to avoid. Further, the current code detects the end-condition (reaching the head of the list in the case of TAILQ_PREV or an empty list in the case of TAILQ_LAST) with no conditional code. That is, after the two indirections, the pointer will be null in the above cases; it is not necessary to put in a check for the end condition in the above macros. Using your technique would require adding a condition. On our increasingly pipelined machines these days, avoiding conditional code is generally a win. Note that the lower performance of CIRCLEQ's was that they needed conditional tests in the traversal macros to detect end conditions. Kirk McKusick To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101041708.JAA05731>