This list_empty_careful() (if u observed carefully, the entire kernel
source code only used it ONCE - only wait->task_list -  which matched
exactly the prerequisite as stated in finish_wait()).

It belongs to the category of sync mechanism called
"lock-free/wait-free" synchronization mechanism.

As stated in the comments in finish_wait(), the lock-free mechanism is
implemented via using TWO variable - testing one after another, and
this is effectively implementing the sync mechanism (other methods of
lock-free methods using atomic instruction exists):

I cannot do justice to this big topic, please check this video out:

Advanced Topics in Programming Languages: A Lock-Free Hash Table
http://video.google.com/videoplay?docid=2139967204534450862

http://www.audiomulch.com/~rossb/code/lockfree/

And many other references on the internet.


On 10/29/07, Bahadir Balban <[EMAIL PROTECTED]> wrote:
> Hi,
>
> For what operations do linked lists require locking in an smp-enabled kernel?
>
> In comments for list_empty_careful() it says it only protects against
> a list_del_init(). Also all the safe traversal macros, do they have
> any issue with list_add() during traversal? IOW, what can you *not* do
> with these safe versions and need a lock?
>
> Thanks,
> Bahadir
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to [EMAIL PROTECTED]
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>


-- 
Peter Teoh
HP: 96809281

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to