-TUHS, +COFF, in line with Warren's wishes.
There is similar code in FreeBSD kernel. Embedding head and next ptrs reduces
memory allocation and improves cache locality somewhat. Since C doesn't have
generics, they try to gain the same functionality with macros. See
https://github.com/freebsd/freebsd/blob/master/sys/sys/queue.h
Not that this is the same as what Linux does (which I haven't dug into) but
I suspect they may have had similar motivation.
I was actually going to say, "blame Berkeley." As I understand it, this code originated in BSD, and the Linux implementation is at least inspired by the BSD code. There was code for singly and doubly linked lists, queues, FIFOs, etc.
I can actually understand the motivation: lists, etc, are all over the place in a number of kernels. The code to remove an element from a list is trivial, but also tedious and repetitive: if it can be wrapped up into a macro, why not do so? It's one less thing to mess up.
I agree it's gone off the rails, however.
- Dan C.