Questions about linked list
I'm looking through the source code for the linked list in <linux/list.h> and I have a few questions. You should probably know that I've never done any kernel writing, and the only C I've been doing for the past 10 years is C++:
- What's rcu? And I'll probably need to know what "rcu protection" is too
- Why no payload? It seems that the payload is to take on struct list_head as member, but why do that? My best guess is that when forward-traversing a list, you don't need to perform any calculation to find the "next" member, because its address is that same as the node's. 'Doesn't seem all that beneficial, though.
- Why poison the next and prev when deleting a node? This seems awfully inefficient debug code. I might do such a thing in an application, but surround the code with #ifndef NDEBUG and then use asserts later. And why poison it to those values? Can there be no danger that those would be addresses assigned to pointers? As far as I know, the only thing you can be guaranteed will never be a pointer to an address is NULL.