Find the answer to your Linux question:
Results 1 to 2 of 2
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    3

    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++:
    1. What's rcu? And I'll probably need to know what "rcu protection" is too
    2. 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.
    3. 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.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,754
    RCU - READ-COPY UPDATE - See the attached gzipped PDF.
    Attached Files Attached Files
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •