Subject: Re: Rationale for converting if list to TAILQ
To: David Jones <dej@eecg.toronto.edu>
From: Chris G Demetriou <Chris_G_Demetriou@lagavulin.pdl.cs.cmu.edu>
List: current-users
Date: 06/29/1995 23:22:23
> Do the core team ever discuss rationale for changes made to the system?
yah.
> The reason I ask is that in the past couple of months, the method used to
> link struct ifnets has changed from a simple pointer to a TAILQ.
Yup, and, indeed, most other lists and queues have as well.
My cut on it is: There are (or were) N different implementations of
basic "linked list" software in the kernel. All of them really
simple, but all of them just slightly different, generally for no good
reason. (some of them, e.g. the few remaining uses of insque and
remque, are the way they are for good reason, and are harder to
change... but it's happening.)
Having N implementations of list handling software is Bad. It may buy
you a tiny bit (perhaps even a "barely measurable" bit!) of
performance, but it makes the code harder to read and harder to work
with, and increases the chance of there being subtle bugs. (Of
course, changing to the queue.h functions has/had the potential for
introducing bugs, but i won't get into that... 8-) The queue macros
were created to 'standardize' queuing functions...
So, i think the answer is "because the queue macros were there, and
because they should be used (where feasible) for all of the lists in
the kernel."
On a slightly different note:
the queue macros allow things to be removed easily. that's likely to
be important for 'struct ifnet's at some point in the future.
and, on a completely different note, in case not all of you knew:
insque() and remque() are Bad and Evil.
cgd